andreyka26_se
609 subscribers
576 photos
66 videos
6 files
289 links
Hey, I'm software engineer at Microsoft, with 7 years of experience. Here we are talking about F(M)AANG big tech interviews: leetcode, system design and corpo life.

YouTube: @andreyka26_se
Instagram: andreyka26_se
TikTok: @andreyka26__
Download Telegram
Hint:
work with array of numbers. any 2 numbers, perform operation and add result back.

This is backtracking problem
Solution:
Since constraints are low, we can afford exponential complexity

Pick any 2 numbers from input array, any possible operation over these numbers and put it as result back to array.
This way you decreased array size by one, and now you can work with subproblem F(n) = F(n - 1)

In the end, when you have only 1 number left - check that it is 24.00000000X (can be floating as we have division)
πŸ‘2
I noticed, streams are very low traffic-wise so I want to do a poll, what better to stream, cause leetcode is not a priority at the moment, all important stuff is over. If you have any other idea - let me know in comment section
Priority?
Anonymous Poll
22%
keep streaming leetcode
43%
more system design
42%
implementations (POC) of system designs (messenger, trading plat, uber, instagram, etc)
34%
topic based stream (1 topic whole stream by voting) e.g. DP, distributed lock, sharding, etc
11%
reading / learning on streams some random thing
10%
prioritize high quality videos/articles instead of long streams
34%
solving real interview problems (leaked)
2%
(propose your idea in discussion)
You will be laughing, but this is as precise as fuck according to managers 4 levels above me.

And I am with 2 screensπŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚
😁10
The solution is straight forward:
- detect zeros subarray
- count number of contiguous subarrays for this zeros subarray
- add it to answer

To count the number of contiguous subarrays in array - you can apply recursion or come up with the formula (if you play enough you will understand it is arithmetic progression: 5 + 4 + 3 + 2 +1 => n + n-1 + n-2 + n-3 ... => n(n+1)/2

Another way is to inline the arithmetic progression while you go
❀1
winners, let's do round robin over it:

1. System Design questions
2. POC (simple implementations) of system design solutions (messenger, trading plat, uber, instagram, whatever else)
3. Topic based stream (by voting), whole stream - same topic
4. Solving real interview problems (leaked somewhere)
πŸ‘10
❀1
Solution

constraints are not that high, so even bruteforce will work (check the biggest consecutive square starting from all Row col combinations

On top of that you might do it in constant time if you have precalculated maximum square to the right and maximum square to the bottom as shown on the picture.

So you define recursive function as "what is the biggest square starting from the current r,c" and add memoization. Bottom up conversion I will post in a bit.
❀1
andreyka26_se
Solution constraints are not that high, so even bruteforce will work (check the biggest consecutive square starting from all Row col combinations On top of that you might do it in constant time if you have precalculated maximum square to the right and maximum…
Hope you already did you own conversion from the top down to bottom up, here it is:
we reuse matrix as our dp table, as it is so convenient. Every cell will represent the maximum length of square that can be formed from this cell, and it is so conveniently precomputed here for us (1 means 1 square is definitely possible, and 0 means no)

Then we reverse the recursive function call stack and start not from the beginning but from the end. We change recursive function call to dp table call and everything else we leave almost the same
❀1
what are you doing , all this leetcode, system design???
me:
😁4