This was the most straightforward and helpful explanation for a program in JAVA I have ever watched. Thank you very much for the excellent video tutorial!
@guffy12679 жыл бұрын
thanks sir ! i am an android developer an i used to solve such problems past in my college days .. . this was amongst one question which i was not able to solve and then completely forgot . .. . ..thanks for such a wonderfull explanation . . i also visited your site to get amazed by such a wonderful spicy question to tickle my brain. . . THANKS AGAIN !
@harshitjain1284 жыл бұрын
what are you doing now? where are you?
@vanshsehgal94754 жыл бұрын
Ummm.. how was android development related to this talk...UHmmm Uhmmm...
@mandeepsharma83057 жыл бұрын
A good teacher makes everything look simple.
@vivaanshah28704 жыл бұрын
Thank you so much!!!!! You've made such an HARD question seem like a piece of cake🍰
@prateekjain77853 жыл бұрын
@Ari Neil what is this...? Why you write this comment on every comment box..?
@codingandmathvideos10 жыл бұрын
You are great at explaining. Definitely better than any professor teaching at MIT, Stanford, Yale, Harvard , IIT, or whatever ivy league school out there. I had problems in my graph algorithms class. I can't wait till you do minimum spanning trees, breadth first search, depth first search, topological sorting, connected components, checking if a graph is cyclic ... all the good graph stuffs. Thanks in advance.
@karthikkedam61176 жыл бұрын
coding math Unfortunately, we lost him to an accident. He is very young and India's best coder..
@sagarjoshi79816 жыл бұрын
@@karthikkedam6117 really 🙁 that's why there is no video on this channel for last 2 years...
@cut-a-lyst5 жыл бұрын
@@karthikkedam6117 oh didn't knew this may his soul RIP
@himanshupoddar13955 жыл бұрын
@@karthikkedam6117 common don't spread rumours, the founder name is Animesh Nayan and he is presently working at google.
@deancareers96395 жыл бұрын
@@himanshupoddar1395 the other guy died though , thats true. RIP :(
@mayankupadhyay68575 жыл бұрын
One of the best tutorial I have seen so far for prog. questions for interview!!
@ikashyap55 жыл бұрын
i can assure one thing that no one can explain things the way u do.. u are incredible !!
@gomzysharma3 жыл бұрын
Give him a gold medal...he explained so well..I'll never forget now
@itspavi8 жыл бұрын
You are the best....The work you are doing is helping so many. Please continue this.
@gladyouseen81605 жыл бұрын
the way u explained achieved my subscription. i loved ur explanation
@shubhamsonicse8 жыл бұрын
thank you very much man. i am unable to understand this program from 4 hours. you helped me a lot
@lravikiran888 жыл бұрын
we can also implement the same using for loops
@gayatribagul20083 жыл бұрын
Y'll if you dont understand for the first time watch it again dont give up he explained this in genius way!
@jinhuang72583 жыл бұрын
Thank you! Your explanation is so clear and straight to the point!
@jaafarskafi17 жыл бұрын
Thank you, sir. You are a god amongst men
@vaddimurthyram33643 жыл бұрын
You really made it in one piece..... Explanation was really awesome. Thanks for explaining this topic.
@Skyblade224 жыл бұрын
Ah yes, I failed an interview because of this question like 10 years ago... Thank you!
@madhurgupta91453 жыл бұрын
Very Sophisticated And Clear Explanation
@kakakukukakakuku8 жыл бұрын
so far the best explanation I have seen for this problem, thanks !
@yashkhatwani31983 жыл бұрын
The explination is just amazing.Thanks
@FaridulIslam-cm5ij3 жыл бұрын
This is the best explanation i have ever seen
@Joyddep4 жыл бұрын
Best explanation so far!
@abocidejofa968611 жыл бұрын
You are simply the best. Please post more programming interview problems.
@arafattai98956 жыл бұрын
Very clear explanation and really easy to understand. Thank you for providing this video
@b_62_ayushmangupta824 жыл бұрын
Thanks a lot !!!! It really helps me a lot. It seems so difficult to me but u made it so simple.
@amanaswal114 жыл бұрын
Unbeatable Explanation.
@Notfcukedupyet3 жыл бұрын
Subscribed. Simple and elegant.
@estefaniac82606 жыл бұрын
Thank you so much for your awesome video!!!!!! You made me understand this algorithm completely in a visual and clear way. :)
@gurmeetchawla83626 жыл бұрын
very well explained this is awesome. In the final code you just need to initialize the dir = 0 in the beginning. it seems, it was there in pseduo code but was missed in the final code.
@stocks4Trading3 жыл бұрын
Love you sir So much .....Made Such a hard question easy for us
@jatinkumar44104 жыл бұрын
Thank you sir for the help. This is one of the questions threatening me.
@shivakrishna80266 жыл бұрын
post some more questions..its really needed for this generation students and u r the best teacher
@gustavolopes52395 жыл бұрын
The final code, where you change the "dir" variable outside the "ifs" statements, you make the algorithm run longer (more iterations). If you change the "dir" inside the "ifs", the following "else if" could enter instantaneously, instead of needing another iteration. It probably won't change the execution time for small inputs, but the code is executing more comparisons (in the while statement: "L
@VirajChokhany4 жыл бұрын
Actually it will enter the else if only in the next iteration as at a time the 'else if' won't run if the 'if' runs.
@lakshaysharma83644 жыл бұрын
just how simply you explained it pls complete the c++ course pls
@komalgujarathi89006 жыл бұрын
perfect explaination and perfect solution
@montutpatel875 жыл бұрын
Superb explanation Guru. Thanks a lot.
@princeakhil2085 жыл бұрын
What a wonderful explanation by @humblefool i am a fan to your teachings..!
@ivandrofly9 жыл бұрын
Thank you so much fella, I think you were born to teach... **PS: You duplicated 2**
@tanmaysethi13739 жыл бұрын
very very nice teaching skills.. u just made this difficult code very much easy to understand... thank you so much :)
@elinxxi7 жыл бұрын
clean like crystal, very good explanation.
@afridimajeed58974 жыл бұрын
Amazing explanation. The kind that I can think about what you said and try to convert it into code on my own. :)
@ajoras91972 жыл бұрын
Thank you soo much, since you made me to understand this code easily
@sasirekhamsvl95044 жыл бұрын
perfect explanation bro
@xXNeoPivXx7 жыл бұрын
That was amazing, the code and the explanation, thanks for the videos, keep it up :D
@mihirvaghela34793 жыл бұрын
realy helpfull after 8 years
@tuantranluuquoc29105 жыл бұрын
I can see that this channel ain't get any new post anymore ! What a shame ! I've just found this one !
@TheVickiScott3 жыл бұрын
Great explanation. My code was similar but much more messy.
@manojpandey75174 жыл бұрын
Only after watching this tutorial does this question feel much much easier.
@IChowdhury013 жыл бұрын
This is absolutely brilliant, thank you.
@Dharmachinta198611 жыл бұрын
Amazing....superb I need more practice at seeing you!
@sribharathgowru76254 жыл бұрын
really a great explanation
@Codistency3 жыл бұрын
op video...finally a very easy explanation
@anurag.tiwari.official4 жыл бұрын
int main() { char this_video; printf("%c",this_video); } Output : Pure GOLD!
@lravikiran888 жыл бұрын
a good understanding of the matrix is important to understand the working logic
@manjun209511 жыл бұрын
Nice, Clear explanation!! Thanks!!
@shoumikdebnath91425 жыл бұрын
It was very helpful.Thank you.
@kautukraj3 жыл бұрын
Very helpful!
@maxsteel45909 жыл бұрын
You made it pretty easy to understand. Thanks
@souravsikaria43875 жыл бұрын
you are insane! thanks for such a beautiful explanation.
@surajtopal99404 жыл бұрын
Thanks a lots sir jiiiiii🙏🙏🙏🙏🙏🙏🙏
@akshhatsrivastava19724 жыл бұрын
Great explanation! Thank you!
@balrajjhaanand48633 жыл бұрын
Beautiful!
@ShinAkuma7 жыл бұрын
Thanks, this was so easy to understand.
@premkumarvasudevan61212 жыл бұрын
Because the order of the directions (and hence the execution of the for loops) dont change, couldnot we get away with the directions variable altogether and only code just the for loops?
@cricketInsights6144 жыл бұрын
Can we do this by recursion also
@apnabharat48578 жыл бұрын
very easy and simple explanation.......thanks !
@keshavraghav38964 жыл бұрын
why does compiler ignore the elements which are already printed. in the given code no such command is executed . so how do compiler prints only those numbers which have to be print?
@panchdevsingh7 жыл бұрын
Hi, may i know the tool you have used to create these videos, especially the writing pad?
@harshitsharma11044 жыл бұрын
Amazing Sir, Thank you so much.
@TANAYSPATEL11 жыл бұрын
VERY VERY THANK YOU.....it's help me lot to understand this problem....!!!
@sachinbhalla145 жыл бұрын
Great Explanation
@rediscoveryourself59567 жыл бұрын
def matrixRot(matrix): row,col=np.shape(matrix) temp=np.empty(shape=[row,col]) for i in range(row): for j in range(col): temp[i,col-1-j]=matrix[j,i] return temp
@adityaverma67335 жыл бұрын
great video from our iiita alumni :)
@TheIndianDev7 жыл бұрын
u r amazing in explaining things :*
@indian87018 жыл бұрын
Can this be done using recursion??
@vanshikasharma89582 жыл бұрын
Explained so well! Though I'm encountering a problem of how to find the number of rows and columns if and 2d array is given. The one I found on internet makes my code fail so , Could anyone please help me out?
@raj_kundalia2 жыл бұрын
Amazing. Thank you!
@lavanyarao56504 жыл бұрын
great explanation thanks a lot!!
@sparshgupta29314 жыл бұрын
What was is the use of dir here??
@SniperofDoomFromKong7 жыл бұрын
For anyone else that was wondering if you can delete the direction variable and the if statements: you can't. Try the case with an 8x1 matrix, i.e. a matrix with 8 rows and 1 column. It won't work there.
@jaychou92562 жыл бұрын
Yeah, I suppose we should re-consider the boundary everytime before we go into the four if statements.
@rupesh05414 жыл бұрын
Hi, without direction tracking it is also working fine because 4 separate loop. can you please write some edge case where without direction tracking it will fail? Thanks for good explanation as always :)
@Chris-cs7nv2 жыл бұрын
I think it always works because we always go left-right, top-bottom, right-left, and bottom-top we just need to update left, right, bottom and top accordingly after going one direction. I could be wrong but that's what I see and understand.
@brokenxsticker6 жыл бұрын
This only seems to work if the matrix is a square (same number of rows as columns). What would you change to make it work on a matrix with 3 rows and 4 elements in each row.
@chandrasekharmamidi22365 жыл бұрын
i am getting a error of13 { C:\Users\hp\Desktop\mcs\spiral print of an 2-d array.cpp [Error] invalid types 'int[int]' for array subscript}. it was repeating for the four printing for loops.and another error was {C:\Users\hp\Desktop\mcs\spiral print of an 2-d array.cpp [Error] cannot convert 'int (*)[50]' to 'int*' for argument '1' to 'void spiralprint(int*, int, int)'} while making the function call spiral print with arguments (a,m,n). can you please resolve it.
@prachimittal78544 жыл бұрын
can you please tell how to print the spiral in inside out format
@devaentgs99574 жыл бұрын
One of the ways can be, adding elements to a stack as we traverse from outside in. Print the contents of the stack.
@riteshbajaj611 жыл бұрын
super clear.....thnks
@unhappysisyphus8 жыл бұрын
Do we even need to have a direction variable and the if-else checks?As the spiral always goes in a regular fashion,why not just write the code for each direction in the direction of the spiral in the while loop without checking the direction ?
@SurbhiShah168 жыл бұрын
Did you figure out why do we need direction variable?
@unhappysisyphus8 жыл бұрын
You don't
@nakulmohan1157 жыл бұрын
I had written a code that had no direction variable. All the directions were executing in a single while loop. The problem with that is that sometimes you need to skip some directions and execute others. So, you'll need to add checks in the for loops so that elements do not get printed twice. This solution is much cleaner as required checks are being executed every time the loop is run . You can try writing code without the direction variable. It would work, but won't be this clean.
@gururajkoti56727 жыл бұрын
Direction variable is required, try executing for matrix of 1X8 dimension without direction variable
@yeeteshpulstya98906 жыл бұрын
rows = 1 cols = 8 matrix = [[1,2,3,4,5,6,7,8]] T,B,L,R = 0,rows - 1,0,cols - 1 while(T < B): for i in range(L,R+1): print(matrix[T][i], end = ' ') T += 1 for i in range(T,B+1): print(matrix[i][R], end = ' ') R -= 1 for i in range(R,L-1,-1): print(matrix[B][i], end = ' ') B -= 1 for i in range(B,T-1,-1): print(matrix[i][L], end = ' ') L += 1 Python code for the problem without direction variable, works for 1X8 matrix as well. So no, we do not need the direction variable.
@sungyunchung11028 жыл бұрын
I just want to check its time complexity and space complexity. Though there is an inner for loop for one-time-while loop, the number of inner for loop is always constant for each while loop iteration. Therefore, I assume the time complexity can be O(n) but I am not quite sure. Also I think space complexity would be O(1) because we don't use any extra space. Can you correct me if I am wrong? Thanks!!
@josephralph76408 жыл бұрын
Sung Yun Chung Time complexity is O(mn), since we are visiting each element once and there are mn elements in the array.
@ImranAliyev6 жыл бұрын
it was amazing explanation!
@niti_sha_jain4 жыл бұрын
It works only for n==m ? because when I apply this algo on 3*4 matrix it failed
@devaentgs99574 жыл бұрын
It works for 3*4 as well.
@lomeshdaheria99603 жыл бұрын
Thanks bhai👍😀
@MilindGupta3 жыл бұрын
I used the exact same code but it's printing main diagonal only on GFG... Kindly check the code // { Driver Code Starts #include using namespace std; // } Driver Code Ends class Solution { public: vector spirallyTraverse(vector matrix, int r, int c) { // code here int dir=0 ; int top=0,left=0,bottom=r-1,right=c-1; vectorans; while(top
@varadharajanr14529 жыл бұрын
Simple & best!!!
@amittapas24295 жыл бұрын
You can use the switch statement for directions, to make the code a little more elegant!
@anurandutta22174 жыл бұрын
Time complexity?
@hitec16915 жыл бұрын
simply beautiful :)
@igotapochahontas6 жыл бұрын
Why are b and r -1? I don't get that...is that because arrays start at [0]?
@gururajkoti56728 жыл бұрын
Nicely explained
@rahulpise18409 жыл бұрын
Sir can u publish the the video on printing pattern like pyramid or any specific pattern?
@wpavada32478 жыл бұрын
Another way to do the same is writing a formula to find the ith element in the spiral form.
@jasminekaurkheterpal92244 жыл бұрын
can someone explain me the while condition
@anksPBN9 жыл бұрын
great ! thanks for the detailed videos
@abocidejofa968611 жыл бұрын
I love how you think to solve problems. How do I develop this type of skills? Can you also solve a N by N tic tac toe? also Sudoku?
@mycodeschool11 жыл бұрын
You need to practice and solve a lot of problems. That's it. :) Yeah, we will get some more in this series.