you all probably dont give a shit but does anyone know a way to get back into an Instagram account..? I was stupid lost my login password. I would love any tricks you can offer me.
@Kole Fabian I really appreciate your reply. I found the site thru google and im trying it out now. Takes quite some time so I will reply here later with my results.
Really great video. Helped a lot to understand the problem and look for a solution. I was able to solve it using the approach you showed in rotating the matrix.
class Solution { fun spiralOrder(matrix: Array): List { val result = mutableListOf() var l = 0 var r = matrix.first().size - 1 val totalSize = matrix.size * matrix.first().size while (l
I attempted to do it in a single loop, with some logic to decide what direction the spiral is moving. It works but took me a while and doesn't perform as well as the above.
better than that in geeksforgeeks(where I had left comment to use self descriptive var names would do well) which was better than that of code school where I disliked the logic & var names
oh my god.. I am just typing the code continuously after his explanation. It was a nightmare before watching this video. +1 for variable naming. That simply made to write flaw less code.
I came back to thank you again orignally I was looking for a solution for spiral matrix 2 and your explanation was so good that I solved a different question with the help of your explanation in this video.
A similar and better solution class Solution { public List spiralOrder(int[][] matrix) { List res = new ArrayList(); if(matrix.length == 0 || matrix[0].length == 0) return res; int top = 0; int bottom = matrix.length-1; int left = 0; int right = matrix[0].length-1; while(true){ for(int i = left; i right || top > bottom) break; for(int i = top; i right || top > bottom) break; for(int i = right; i >= left; i--) res.add(matrix[bottom][i]); bottom--; if(left > right || top > bottom) break; for(int i = bottom; i >= top; i--) res.add(matrix[i][left]); left++; if(left > right || top > bottom) break; } return res; } }
Now I understand where those ifs come from. Thank you!
Same Here. THUMBS UP!
I live how you explain so thoroughly and use brute force thats understandable and not too optimal to get! Thanks!!
you all probably dont give a shit but does anyone know a way to get back into an Instagram account..?
I was stupid lost my login password. I would love any tricks you can offer me.
@Brentley Randy instablaster :)
@Kole Fabian I really appreciate your reply. I found the site thru google and im trying it out now.
Takes quite some time so I will reply here later with my results.
@Kole Fabian It worked and I finally got access to my account again. I am so happy!
Thanks so much, you really help me out :D
@Brentley Randy You are welcome :D
Of all the videos I watched so far, this one is well explained.
true ;)
great job dood. keep doing this
thanks for helping me understand how to solve this problem!!
I dont know anything about coding but the coco powder almonds are really good! Thanks for the suggestion Nick!!
Really great video. Helped a lot to understand the problem and look for a solution. I was able to solve it using the approach you showed in rotating the matrix.
class Solution {
fun spiralOrder(matrix: Array): List {
val result = mutableListOf()
var l = 0
var r = matrix.first().size - 1
val totalSize = matrix.size * matrix.first().size
while (l
but looks like your solution is much faster
Great.... Thumbs up to the clearity of your explanations!
Thanks this is great explanation and variable naming!
very well explained especially descriptive variable names make it easier
Good one! It made it very easy! Thank you
I like how you use descriptive variable names instead of i and j
Nick is the best!
Great way to understand! Thank you!
It's a fun problem. Thanks Nick 😊
what a nice explaination thanks a ton brother. please keep making such videos.
So cool idea!
Thank you a lot for your efforts!!!
As always great work sir 👍
Awesome explanation ! Thanks
Great solution! Very intuitive.
Great video! Thank you so much!!!
I attempted to do it in a single loop, with some logic to decide what direction the spiral is moving. It works but took me a while and doesn't perform as well as the above.
You are awesome bro.!! Love from India
Great Explanation ! dude
Feel much better to solve problems while watching your video
That was very understandable.. Thank you
woooow, it is very simple using boundaries
Thanks for this. Also, +1 on chocolate covered almond things.
It would be nice if you can post the solution in Github.
Best explaination..thanx man
What is the time and space complexity for this solution?
can u explain the if check inside whike loop
awesome solution
better than that in geeksforgeeks(where I had left comment to use self descriptive var names would do well) which was better than that of code school where I disliked the logic & var names
oh my god.. I am just typing the code continuously after his explanation. It was a nightmare before watching this video. +1 for variable naming. That simply made to write flaw less code.
great work, what's the time complexity?
O(N) - N is number of elements the matrix
Thanks
I came back to thank you again orignally I was looking for a solution for spiral matrix 2 and your explanation was so good that I solved a different question with the help of your explanation in this video.
Can anyone, please explain the time complexity for this algorithm?
If you don't want to type the code, you can get it from here github.com/eMahtab/spiral-matrix
love it!
Gooooood!
A similar and better solution
class Solution {
public List spiralOrder(int[][] matrix) {
List res = new ArrayList();
if(matrix.length == 0 || matrix[0].length == 0) return res;
int top = 0;
int bottom = matrix.length-1;
int left = 0;
int right = matrix[0].length-1;
while(true){
for(int i = left; i right || top > bottom) break;
for(int i = top; i right || top > bottom) break;
for(int i = right; i >= left; i--) res.add(matrix[bottom][i]);
bottom--;
if(left > right || top > bottom) break;
for(int i = bottom; i >= top; i--) res.add(matrix[i][left]);
left++;
if(left > right || top > bottom) break;
}
return res;
}
}
hwo to treaverse this spiral matrix in O(logn) time?
please give a solution in O(logn) time
please please