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
I wanted to discuss one thing, about time complexity analysis

SPOILER
SPOILER
SPOILER
SPOILER
SPOILER
SPOILER
SPOILER
SPOILER

Do you see the difference between these 2 DP functions?

I'm a bit БОМБЛЮ because, I have seen a lot of similar problem analysis when authors would name both of these as O(2^n).

FUCK NO. these are different complexities, and today's daily proves it, you can submit it as comb2 and you'll get Time Limit Exceeded.

Without memoization the complexities:

comb time complexity O(2^n), as 2 decisions only

comb2 time complexity is approximately O(n/2 * 2^n) => O(n* 2^n), as on every next call we are doing n - k calls. It will approximate to n / 2, a bit hard to analyse but definitely not pure 2^n
🤯2
top down/bottom up solutions
🔥3
Follow up

knapsack 0/1 space optimization, converting DP 2D to DP 1D
3
This feeling of merging PR that was open for 2 weeks😤🤤
😁9
Follow up in constant time O(1).

We take the maximum possible power of 3 num in the constraints `n <= 2^31 - 1`.
And then if number is positive - check if the reminder will be zero


If you have only 1 run, then, yeah, you might calculate all power of 3, put them to map, and then in constant time chech if n is in map
🔥3🤯21
At MS at my project, we are trying to stick to Scrum, but in reality it is something hybrid.
So, we usually don't have any estimations, if we do - these estimations on big features, and they are estimated in weeks. A lot of work load so a lot of reprioritization.

I was just checking my tasks, some of them were very old, and this is the outcome
- some repair item to fix the pipeline -> we migrated to new pipeline, so it is autoclosed
- some cleanup for skype related migration -> skype is done, so autoclosed,
...

I like how big corpo works xDD I closed a lot of shit by doing really nothing today
😁4
Amazon has bipolar disorder. Yesterday's evening I got an email
Today's morning
🤔4😁2🤮1
wtf?
Solutions
- "sliding window" based
- opposite - apply contains() to all of the possible candidates (10)


Both O(n) time and O(1) space, as these candidates are considered as constant (10 items)
2
andreyka26_se
Amazon has bipolar disorder. Yesterday's evening I got an email
btw, even if you are not looking for job - it is always a good idea to interview, at least it works like that for me. Some challenge, some confirmation of your skills, etc. Never rejected single opportunity even if not looking for something new
8👍1
So, lets do stream on Saturday this time. Again, it is going to be stream about DP, how to do top down and convert to bottom up + memory optimization.

Also we are going to implement sharding of all popular storages: Redis, dynamo, cassandra, etc
🔥91
Solutions
🔥4
Do you remember we were talking about Messenger or Presence Service System design?
There was a problem: how to keep hundreds of millions clients on websockets? I loooked up some stuff, and this is basically the solution (high level) that works in production.

We basically do not need any web socket server manager. WebSocket node itself will manage the state in Redis. That is it.
🔥5