Microsoft Coding Interview Question - Rotate Image

  Рет қаралды 8,727

AlgosWithMichael

AlgosWithMichael

Күн бұрын

Пікірлер: 15
@pallavgupta7300
@pallavgupta7300 Жыл бұрын
We can also reverse rows and then transpose that will decrease complexity for i in range(len(matrix)//2): matrix[i],matrix[len(matrix)-i-1]=matrix[len(matrix)-1-i],matrix[i] for i in range(len(matrix)): for j in range(i,len(matrix)): matrix[i][j],matrix[j][i]=matrix[j][i],matrix[i][j]
@nwokolobueze7291
@nwokolobueze7291 2 жыл бұрын
This explanation is for dummies like myself. Thanks Michael.
@anupestuff
@anupestuff 4 жыл бұрын
Hey Michael, I highly appreciate your effort for making the video. It takes lot of effort and I understand that fact. I also wanted to mention that as an experienced developer I expected you to understand the fact that 99% of the engineers won't know this transpose and reverse method and the expectation here is to be able to solve it with just logic. Good numbers of folks have solved it using just logic and playing around with indexes and same complexity. Refer to leetcode discuss section. I feel you should promote logic reasoning than knowledge based answer. Good Luck and hope you take this as positive criticism.
@AlgosWithMichael
@AlgosWithMichael 4 жыл бұрын
True, thanks for the feedback
@tl7955
@tl7955 Жыл бұрын
Dude I can’t express how clear u delivered. You have the best tempo and explain i ve ever saw. I have to comment to show how good you r. Btw i like the keyboard sound!
@tl7955
@tl7955 Жыл бұрын
At meanwhile, u can consider buy you a graphics tablet. It’s fun and helps recording videos a lot
@AlgosWithMichael
@AlgosWithMichael Жыл бұрын
I appreciate that!
@RohitKulkarni0810
@RohitKulkarni0810 4 жыл бұрын
Your videos are great my guy! Thanks for helping everyone out!
@AlgosWithMichael
@AlgosWithMichael 4 жыл бұрын
Happy to help!
@RohitKulkarni0810
@RohitKulkarni0810 4 жыл бұрын
@@AlgosWithMichael lmao I have a placement test in 8 hours and I've only been watching your playlists for over 4 hours now and it's helped me so much. Keep doing what you do man, you deserve all the support!
@AlgosWithMichael
@AlgosWithMichael 4 жыл бұрын
Eh I appreciate that man. Hope you did well!
@剑胆琴心吉他弹唱
@剑胆琴心吉他弹唱 4 ай бұрын
Thanks Michael! This Transpose (flip diagonally) + reverse(columns) algorithm is mind blowing! Very simple and easy to follow. I am thinking on top of my mind if this is also going to work. Swap element at ( i, j ) with element at ( j, n-1-i ). Can you please provide some insight on this? Thank you very much!
@yitingg7942
@yitingg7942 4 жыл бұрын
This is so mind-blowing lol. How did you think of it Michael ? Thanks a lot for taking your time to fully explain it again!
@AlgosWithMichael
@AlgosWithMichael 4 жыл бұрын
Of course, thank you for watching!
@AxelKingsley
@AxelKingsley 3 жыл бұрын
Hi Michael, looking in your video description, I don't agree with your assessment that the runtime is O(N^2). Here's my reasoning: Logarithmic Running Time is defined as the increase in runtime *in proportion* to your input. Looks like the way you're defining it, the runtime is N-squared if N is the number of Rows. While that's technically true, it doesn't take into account that each row is *also* increasing in size whenever you add an element. Here are some examples: 2 x 2 Matrix: There are 4 cells in your input 3 x 3 Matrix: There are 9 cells in your input 4 x 4 Matrix: There are 16 cells in your input So, while the runtime is increasing exponentially for each row you add, it *isn't* because of the algorithm, but instead entirely to do with the fact that the amount of input is also increasing exponentially. A better way to define the runtime of this solution is O(N), where N is the number of "pixels" in your matrix. It just so happens that the valid inputs to the problem *only* come in square sizes (1, 4, 9, 16, 25), so it appears to increase at N-squared rate when you increase the dimensions of the input. Another way of looking at this: What if the requested algorithm only counted each cell and returned the tally? It wouldn't be fair to say that the tally function runs in N-squared time, because every time you add a new row, every row also gets bigger. The *input* increases at the same rate as the runtime, and therefore it is reasonable to label this as O(N), linear time.
Amazon Coding Interview Question - Number of Distinct Islands
17:43
AlgosWithMichael
Рет қаралды 26 М.
How I Failed the Google Coding Interview (and lessons I learned)
14:24
Disrespect or Respect 💔❤️
00:27
Thiago Productions
Рет қаралды 43 МЛН
If people acted like cats 🙀😹 LeoNata family #shorts
00:22
LeoNata Family
Рет қаралды 11 МЛН
Amazon Coding Interview Question - Sum of Left Leaves (LeetCode)
16:17
AlgosWithMichael
Рет қаралды 4,6 М.
struct Basics | C Programming Tutorial
24:44
Portfolio Courses
Рет қаралды 149 М.
Dijkstra's Algorithm - Computerphile
10:43
Computerphile
Рет қаралды 1,3 МЛН
2024 Citadel Quant Trading Interview with Analysis from Real Quants
23:23
Longest Increasing Path in a Matrix (DFS + Memoization)
18:47
AlgosWithMichael
Рет қаралды 19 М.
Google Coding Question - Making a Large Island (Hard)
25:11
AlgosWithMichael
Рет қаралды 16 М.
Merge Sort Algorithm in Java - Full Tutorial with Source
23:02
Coding with John
Рет қаралды 187 М.