If you want to discuss something specific - leave the comment - we gonna review every single comment
🔥1
Let's go:
https://www.youtube.com/watch?v=BnM14XIRbFM&ab_channel=andreyka26_se
https://www.twitch.tv/andreyka26_
https://www.youtube.com/watch?v=BnM14XIRbFM&ab_channel=andreyka26_se
https://www.twitch.tv/andreyka26_
YouTube
LeetCode and System Design with Microsoft SWE #6
Solving LeetCode questions and doing System Design with Microsoft SWE
TG: @programming_space
https://t.me/programming_space
IG: andreyka26_se
https://www.instagram.com/andreyka26_se/
Blog: https://andreyka26.com
00:00:00-00:08:51 - Intro
00:08:51-00:16:07…
TG: @programming_space
https://t.me/programming_space
IG: andreyka26_se
https://www.instagram.com/andreyka26_se/
Blog: https://andreyka26.com
00:00:00-00:08:51 - Intro
00:08:51-00:16:07…
Welcome everyone who is new. Thanks for following. I would appreciate any feedback, and suggestion for the next stream and videos/articles.
🔥6
andreyka26_se
Let's go: https://www.youtube.com/watch?v=BnM14XIRbFM&ab_channel=andreyka26_se https://www.twitch.tv/andreyka26_
For those who are new and came from Vlad or Ihor (thank you both guys ❤️):
Vlad is my friend, ex-Microsoft Engineer, doing Youtube as well, very skilled guy, he really teaches leetcode(not like me), so you could sign up for his courses and he will teach you how to pass algo interview:
https://www.youtube.com/@vladtenten
https://t.me/tenfoundation
Ihor is my friend, and he is ex-Microsoft Engineer as well. He is owning his own company at the moment related to AI. If you are business or need AI solution - reach out to him: @ihorcodes
I am Andrii, Software Engineer at Microsoft (for 3 years already almost), part of the team, that is doing backend for presence (online/away/inacall bubble in teams/outlook). Here we are doing different stuff related to software engineering, but lately I started recovering my knowledge in LeetCode (that I'm very bad at) and System Design (that I'm a bit better, but still bad), since it is time to have some interviews to keep my form.
Vlad is my friend, ex-Microsoft Engineer, doing Youtube as well, very skilled guy, he really teaches leetcode(not like me), so you could sign up for his courses and he will teach you how to pass algo interview:
https://www.youtube.com/@vladtenten
https://t.me/tenfoundation
Ihor is my friend, and he is ex-Microsoft Engineer as well. He is owning his own company at the moment related to AI. If you are business or need AI solution - reach out to him: @ihorcodes
I am Andrii, Software Engineer at Microsoft (for 3 years already almost), part of the team, that is doing backend for presence (online/away/inacall bubble in teams/outlook). Here we are doing different stuff related to software engineering, but lately I started recovering my knowledge in LeetCode (that I'm very bad at) and System Design (that I'm a bit better, but still bad), since it is time to have some interviews to keep my form.
YouTube
Vlad Ten
IOIO - Vlad Ten
🔥6
Since I'm solving the leetcode on daily basis rn, I would be pasting here some problems, and we can share the answers, thoughts, etc. RN I'm doing LeetCode 75 list.
So today is Binary Search. So let's recall how to do it:
https://leetcode.com/problems/guess-number-higher-or-lower/description/?envType=study-plan-v2&envId=leetcode-75
So today is Binary Search. So let's recall how to do it:
https://leetcode.com/problems/guess-number-higher-or-lower/description/?envType=study-plan-v2&envId=leetcode-75
LeetCode
Guess Number Higher or Lower - LeetCode
Can you solve this real interview question? Guess Number Higher or Lower - We are playing the Guess Game. The game is as follows:
I pick a number from 1 to n. You have to guess which number I picked (the number I picked stays the same throughout the game).…
I pick a number from 1 to n. You have to guess which number I picked (the number I picked stays the same throughout the game).…
🔥2
andreyka26_se
Since I'm solving the leetcode on daily basis rn, I would be pasting here some problems, and we can share the answers, thoughts, etc. RN I'm doing LeetCode 75 list. So today is Binary Search. So let's recall how to do it: https://leetcode.com/problems/guess…
The solution:
```
var guessNumber = function(n) {
let left = 1
let right = n
while (left <= right) {
let mid = left + Math.floor((right - left) / 2)
let guessed = guess(mid)
if (guessed === 0) {
return mid
}
if (guessed === 1) {
left = mid + 1
} else if (guessed === -1) {
right = mid - 1
}
}
return -1
};
```
Basically - it is simple binary search algorithm, but instead of checking sorted array, we are checking single number everytime.
```
var guessNumber = function(n) {
let left = 1
let right = n
while (left <= right) {
let mid = left + Math.floor((right - left) / 2)
let guessed = guess(mid)
if (guessed === 0) {
return mid
}
if (guessed === 1) {
left = mid + 1
} else if (guessed === -1) {
right = mid - 1
}
}
return -1
};
```
Basically - it is simple binary search algorithm, but instead of checking sorted array, we are checking single number everytime.
🔥2❤1
Im thinking about this one rn: last stream we did system design of rate limiter. It would not be that hard to implement mvp next time. Our own rate limiter with black jack and whores, what do u think?? Should I prepare it for the next stream?
👍5❤1
Today's backtracking problem:
https://leetcode.com/problems/letter-combinations-of-a-phone-number/description/?envType=study-plan-v2&envId=leetcode-75
https://leetcode.com/problems/letter-combinations-of-a-phone-number/description/?envType=study-plan-v2&envId=leetcode-75
LeetCode
Letter Combinations of a Phone Number - LeetCode
Can you solve this real interview question? Letter Combinations of a Phone Number - Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent. Return the answer in any order.
A mapping of…
A mapping of…
🔥3
andreyka26_se
So, about our backtracking. In the comments I will post different solutions. Feel free to post yours as well, and we can discuss. There will be with spoiler, so no worries.
Now, the interesting part is the complexity. Have a look into the backtracking call stack.
what is the time complexity you would think?
Consider that worst case, at each step is to 4 subnodes, as some numbers correspond to 4 characters instead of 3 as in example
what is the time complexity you would think?
Consider that worst case, at each step is to 4 subnodes, as some numbers correspond to 4 characters instead of 3 as in example
❤2
The tree simplifies the idea, basically on every call, you are calling function recursively 4 times (worst case) or 3 times (best case).
For the worst case it means we will have O(4^n), where n is the length of the initial digits string.
Let's break down:
First layer: 4 calls = 4,
Second layer: 4 calls are doing 4 calls = 4 * 4 = 16
Third layer: 16 calls are doing 4 calls = 16*4 = 64
... and so on.
Formally it is simplified to this 4 * 4 * 4 * 4 ... n => 4^n
For the worst case it means we will have O(4^n), where n is the length of the initial digits string.
Let's break down:
First layer: 4 calls = 4,
Second layer: 4 calls are doing 4 calls = 4 * 4 = 16
Third layer: 16 calls are doing 4 calls = 16*4 = 64
... and so on.
Formally it is simplified to this 4 * 4 * 4 * 4 ... n => 4^n
❤2
andreyka26_se
Seems like I got day off starting from now xDDD The thing is that everything is connected to MS account, and if I cannot log in - I cannot work
so it turned out that windows client DNS was broken. It happened to other people as well, and we ended up updating hosts file.
MS....
MS....
🤯2
Let's GOOOOOO
Dynamic Programming. I think this was the hardest topic for me back then. I might post a bit more problems related to dynamic programming then.
https://leetcode.com/problems/n-th-tribonacci-number/description/?envType=study-plan-v2&envId=leetcode-75
Dynamic Programming. I think this was the hardest topic for me back then. I might post a bit more problems related to dynamic programming then.
https://leetcode.com/problems/n-th-tribonacci-number/description/?envType=study-plan-v2&envId=leetcode-75
❤2
I came to the conclusion, that the best way to solve it is to do 3 step solutions.
Usually it looks like that:
1. brute force + recursion
2. top down: recursion + memoization (save sub problems' responses to map)
3. bottom up: start with sub problems' responses array and solve base cases. Then iterate and calculate the bigger subproblems based on previous (smaller)
Today we gonna solve this Tribonacci number using 3 approaches.
Usually it looks like that:
1. brute force + recursion
2. top down: recursion + memoization (save sub problems' responses to map)
3. bottom up: start with sub problems' responses array and solve base cases. Then iterate and calculate the bigger subproblems based on previous (smaller)
Today we gonna solve this Tribonacci number using 3 approaches.
❤2
andreyka26_se
Let's GOOOOOO Dynamic Programming. I think this was the hardest topic for me back then. I might post a bit more problems related to dynamic programming then. https://leetcode.com/problems/n-th-tribonacci-number/description/?envType=study-plan-v2&envId=leetcode…
If you already solved basic fibonacci number before - you would already know the naive recursive solution. This is first step to solve the Dynamic Programming problem.
❤2
andreyka26_se
If you already solved basic fibonacci number before - you would already know the naive recursive solution. This is first step to solve the Dynamic Programming problem.
If you start building the call stack tree - you will see that there are a lot of function call with the same argument.
The time is exponential: every function call we are calling recursive function 3 times. So it is 3^n time somplexity. The space complexity is the height of this tree = O(n).
I think the call stack tree should lead you to the optimization here
The time is exponential: every function call we are calling recursive function 3 times. So it is 3^n time somplexity. The space complexity is the height of this tree = O(n).
I think the call stack tree should lead you to the optimization here
❤1