No video

Spiral Traversing A Matrix Solution ( LeetCode #54 ) | FREE DSA Course in JAVA | Lecture 85

  Рет қаралды 5,839

TAP ACADEMY

TAP ACADEMY

Күн бұрын

It is an interesting question where we have to traverse a matrix in a spiral format.
So the question is, we have to write a program to print the elements of a given 2D array/matrix of size m*n in spiral order.
So for the matrix,
1,2,3,
4,5,6
7,8,9
The output will be 1,2,3,6,9,8,7,4,5.
Let's see how we can come up with an approach to deal with this program and solve it.
Hint - We are again and again moving in a pattern as left to right, top to bottom, right to left, and bottom to top. You have to use this pattern to approach the program.
Subscribe ‪@TAPACADEMY‬
For more information, fill this form: forms.gle/8eiU...
or call us at 8884881203
Facebook: / thetapacademy
Instagram: / tapacademy_online
Linkedin: / 73820805
Website: www.thetapacad...​

Пікірлер: 11
@user-hx1kp8kr4m
@user-hx1kp8kr4m 2 ай бұрын
Excellent Explanation Sir
@KRajesh-ej7dy
@KRajesh-ej7dy Жыл бұрын
Sir Excellent Explination
@paisastocks8363
@paisastocks8363 11 ай бұрын
Perfect 💯
@hari7110
@hari7110 6 ай бұрын
great explanation bro
@kethavatharyan3255
@kethavatharyan3255 11 ай бұрын
Great
@akarshgupta4981
@akarshgupta4981 11 ай бұрын
Great explanation! Thank you soo much.
@user-bu4rv9od7b
@user-bu4rv9od7b Жыл бұрын
superb explanation sir.
@Arjunsingh-cf7nf
@Arjunsingh-cf7nf Жыл бұрын
owsome question
@Raubritterr222
@Raubritterr222 3 ай бұрын
sir, I am saying, this is the best explanation of spiral matrix! ...I hope its clear 😉
@manoranjankumarjha3776
@manoranjankumarjha3776 10 ай бұрын
class Solution { public List spiralOrder(int[][] matrix) { ArrayListres = new ArrayList(); int top = 0, bottom = matrix.length-1; int left = 0,right = matrix[0].length-1; while(left>> right top are constant for(int i=left;ibottom for(int i = top;i>>left for(int i=right;i>=left;i--) { res.add(matrix[bottom][i]); } bottom--; // bottom---->>>top for(int i = bottom;i>=top;i--) { res.add(matrix[i][left]); } left++; } return res; } }
@saurabhdwivedi7699
@saurabhdwivedi7699 8 ай бұрын
Can anyone please explain me my whole code is same but when i write :- ( result.add(arr[i][right] ); It is showing me error that the type java.util.AbstractList cannot be resolved
Java Tutorial for Beginners (Part 1) | TAP Academy
2:19:33
TAP ACADEMY
Рет қаралды 118 М.
Dr Joe Dispenza: You MUST Do This Before 10am To Fix It!
2:00:06
The Diary Of A CEO
Рет қаралды 9 МЛН
КТО ЛЮБИТ ГРИБЫ?? #shorts
00:24
Паша Осадчий
Рет қаралды 2,3 МЛН
PEDRO PEDRO INSIDEOUT
00:10
MOOMOO STUDIO [무무 스튜디오]
Рет қаралды 9 МЛН
Bony Just Wants To Take A Shower #animation
00:10
GREEN MAX
Рет қаралды 7 МЛН
طردت النملة من المنزل😡 ماذا فعل؟🥲
00:25
Cool Tool SHORTS Arabic
Рет қаралды 16 МЛН
synthwave radio 🌌 - beats to chill/game to
Lofi Girl
Рет қаралды 2,5 М.
I gave 127 interviews. Top 5 Algorithms they asked me.
8:36
Sahil & Sarra
Рет қаралды 642 М.
Spiral square number pattern in C language | #SkillupwithGenie
15:20
SkillUp with Genie
Рет қаралды 3,4 М.
Solve Any Pattern Question With This Trick!
57:20
Kunal Kushwaha
Рет қаралды 2,3 МЛН
КТО ЛЮБИТ ГРИБЫ?? #shorts
00:24
Паша Осадчий
Рет қаралды 2,3 МЛН