andreyka26_se
610 subscribers
566 photos
66 videos
2 files
284 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
Tomorrow going for my first vacation maybe in 3 years, where I'm not going for interview onsite or something like that. And hopefully I will get to some sea (if we don't crush in airplane).

And soon will tell you story about kiwi and Croatian airlines. THe stupidest shit ever happened on this kind of service. I mean, I literally wanted to tell their support: pay me my 30$/h and I will show you how these services should be designed, implemented AND TESTED!!
😁10👍1🤔1
BUT,

Daily leetcode will be performed no matter what!!! Maybe we even do small stream, we will see
8
This media is not supported in your browser
VIEW IN TELEGRAM
Solution

I'm under kynedryl, so completely zoned out. I made up some backtracking solution, it is not the best, ofc, but it passes.
In general - we try every possible number, until we reach the end. If we reached the end - it is solved.
4
Now better, much better
As the guy, who already had 5 surgeries, and knows what is it random health shit - stating rn: “I fuck your bullshit shit”. First day, I somehow stepped in the stone in the sea, and injured toe, cause it was slippery and I unsuccessfully stepped somehow and got injury. Now I cannot walk properly.

Not stating, that flight got cancelled 15h before, so we had to do flight with stops , and pay extra for this.

Like man, wtf is this. Now in worst case I will go to ambulance locally, average case will be almost not walking, and best case 1-2 days and it will recover enogh. Like doc and gpt tells me it is not that serious, can wait 4-5 days until I go back, but fuck, what a luck.
🤯4
andreyka26_se
https://youtu.be/kFRAQO-JE9M?si=mEBVhmjeTQJ1Tbzp
Literally me cursing all this “lucky” shit, but mostly health. Idk it is ridiculously randomized in a bad way somehow during the life. Is it only me?
Hint: observe the following if you have 1/2 => 0.5, and 3/5 => 0.6
Try adding extra student to each of them and check what will improve things more:

1/2 => 2/3 => 0.66; 0.66-050 = 0.16

3/5 => 4/6 => 0.66; 0.66-0.60 = 0.01

so 0.16>0.01. Now you need to do it for all the numbers.


Solution:
Use the max heap, whereas the key is the gain that will happen if we add the extra student. Use this key in heap (python does not have max heap, so we will work with just negative number to emulate it).

Now for all extra student every single time you get the class where you can get the biggest gain, and add this gain -> then push it back to the heap.

In the end we just calculate the average
2
Tommy, where is my money??
🔥8😁7
Hint: the data constraints are 0 >= n >= 50, it means you definitely can allow yourself n^2 or n^3. Don't overthink much, don't think about optimization.

Solution: yeah, in official one it is the same just bruteforce it: try every possible point, (right bottom) find all the points that match the criteria (left up), for this pair: check whether there is any other point inside. If no point is inside - increment counter.
4