6. Zigzag Conversion | Leetcode | Medium | Java | String | Google

  Рет қаралды 6,407

AlgorithmHQ

AlgorithmHQ

5 ай бұрын

"Zigzag Conversion" an intermediate-level problem on LeetCode serves as a foundational exercise for developing intuition in problem-solving, particularly for challenges that demand a keen understanding of patterns and logical reasoning. The crux of this question lies in recognizing the strategic necessity of utilizing multiple strings to construct the final string, which represents a sequence of rows. The intricacy of the zigzag pattern introduces the need for a methodical approach, wherein two distinct directions of traversal across the rows play a crucial role.
This problem not only tests one's ability to discern intricate patterns but also demands a strategic mindset to navigate through multiple rows in a zigzag fashion, ultimately leading to a comprehensive and efficient solution.
Link to the question: leetcode.com/problems/zigzag-...
Other problems for practice:
• 417. Pacific Atlantic ...
• 289. Game of Life | Le...
• 211. Design Add and Se...
• 36. Valid Sudoku | Lee...
• 399. Evaluate Division...
• 2332. The Latest Time ...
• 1110. Delete Nodes And...
• 797. All Paths From So...
• Minimum Height Trees |...

Пікірлер: 24
@ShinAkuma
@ShinAkuma 14 күн бұрын
Good solution. I'd use StringBuilder instead of String wherever lots of manipulation is required. It's faster and consumes less memory since extra objects are not being created every time you add a character.
@Ybash2979
@Ybash2979 Ай бұрын
i haven't seen much of your content , but the ones seen the solutions are too accurate and easy !!
@algorithmsbyaditi
@algorithmsbyaditi 24 күн бұрын
Thank youu !
@tanaysrivastava9303
@tanaysrivastava9303 9 күн бұрын
Nice explaination ma'am, but can you further explain the code in upcoming videos ,it would be helpful....
@algorithmsbyaditi
@algorithmsbyaditi 9 күн бұрын
Will improve, Thanks.
@naveennaik3705
@naveennaik3705 5 ай бұрын
Great video🔥🔥 aapke videos dekh ke Mera DSA mein interest badh raha hai. Keep it up
@algorithmsbyaditi
@algorithmsbyaditi 4 ай бұрын
Thank you so much 😊
@motivationworld27
@motivationworld27 4 ай бұрын
Line mar ra hai aap par me bata hu clear aapko improve karna chye apko padhane ka way but knowledge hai apko
@sushantnand3974
@sushantnand3974 3 ай бұрын
Neetcode faltu me chada rakha h, 2min me samjhaya didi ne, thankss
@algorithmsbyaditi
@algorithmsbyaditi 2 ай бұрын
Thank youu !
@samchopra100
@samchopra100 3 ай бұрын
Nice explanation! I got an idea from your video that how can we solve it. Optimised your solution to solve it with single iteration. Swift Code: func convert(_ s: String, _ numRows: Int) -> String { guard numRows != 1 else { return s } var temp = [String](repeating: "", count: numRows) var count: Int = 0 for (index, ele) in s.enumerated() { if (index + 1 + count) % numRows == 0 { count += 1 } let isBottom = count % 2 != 0 if isBottom { temp[numRows - 1 - ((index + count) % numRows)] = temp[numRows - 1 - ((index + count) % numRows)] + String(ele) } else { temp[(index + count) % numRows] = temp[(index + count) % numRows] + String(ele) } } return temp.reduce(into: "") { (p , c) in p += c } }
@algorithmsbyaditi
@algorithmsbyaditi 2 ай бұрын
Great work !
@Ayush37262
@Ayush37262 5 ай бұрын
Awesome explanation!!! How to think like that? I was solving this question using a matrix and storing every character in it 😢
@algorithmsbyaditi
@algorithmsbyaditi 4 ай бұрын
Just need to think that the number of strings to be concatenated is equal to the number of rows.
@user-of3ss6hb2l
@user-of3ss6hb2l 5 ай бұрын
Great explanation 😮
@Viratrohit184
@Viratrohit184 20 күн бұрын
Please make video in English
@gamewalabhai01
@gamewalabhai01 3 ай бұрын
mene khud ka code banaya alag uska runtime 15ms aa raha hai submit karne per.
@shivam1gaur
@shivam1gaur 2 ай бұрын
Radhe Radhe
@meetpatel2720
@meetpatel2720 4 ай бұрын
How many leetcode questions are enough for freshers? your linkedin?
@amanisdreaming3914
@amanisdreaming3914 4 ай бұрын
probably 250-300. also depends on your cognitive skills.
@randomeverything8304
@randomeverything8304 2 ай бұрын
150 are enough. baaki tension lene se kuch nhi hota. Enjoy life.
@meetpatel2720
@meetpatel2720 2 ай бұрын
@@randomeverything8304 gand fati padi he yahape apply karte karte
@trendingYT80
@trendingYT80 2 ай бұрын
Kuch samjh mai nahi aaya jo aap samjha rahe ho
@kumarshresth7511
@kumarshresth7511 Ай бұрын
dhyaan thumbnail pe hoga,to kaha se aayega!
36. Valid Sudoku | Leetcode | Medium | Java | Amazon
17:34
AlgorithmHQ
Рет қаралды 1,7 М.
Schoolboy - Часть 2
00:12
⚡️КАН АНДРЕЙ⚡️
Рет қаралды 5 МЛН
Slow motion boy #shorts by Tsuriki Show
00:14
Tsuriki Show
Рет қаралды 10 МЛН
CHOCKY MILK.. 🤣 #shorts
00:20
Savage Vlogs
Рет қаралды 15 МЛН
Mama vs Son vs Daddy 😭🤣
00:13
DADDYSON SHOW
Рет қаралды 50 МЛН
Solving Leetcode Biweekly 133 in 10 mins.
11:55
aryanc403 screencasts
Рет қаралды 1,3 М.
DSA Phir se with Sumeet | Leetcode 6 | Zigzag Conversion
17:54
Leetcode 6 Zigzag Conversion | Java | English
11:43
BitsAndBytes
Рет қаралды 2,1 М.
ZigZag Conversion - Leetcode 6 - Python
12:46
NeetCode
Рет қаралды 95 М.
Schoolboy - Часть 2
00:12
⚡️КАН АНДРЕЙ⚡️
Рет қаралды 5 МЛН