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

  Рет қаралды 11,116

AlgorithmHQ

AlgorithmHQ

Күн бұрын

Пікірлер: 28
@YashChandanshiv-xf5kg
@YashChandanshiv-xf5kg 3 күн бұрын
great approach
@ShinAkuma
@ShinAkuma 3 ай бұрын
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.
@naveennaik3705
@naveennaik3705 8 ай бұрын
Great video🔥🔥 aapke videos dekh ke Mera DSA mein interest badh raha hai. Keep it up
@algorithmsbyaditi
@algorithmsbyaditi 8 ай бұрын
Thank you so much 😊
@motivationworld27
@motivationworld27 7 ай бұрын
Line mar ra hai aap par me bata hu clear aapko improve karna chye apko padhane ka way but knowledge hai apko
@Ybash2979
@Ybash2979 4 ай бұрын
i haven't seen much of your content , but the ones seen the solutions are too accurate and easy !!
@algorithmsbyaditi
@algorithmsbyaditi 4 ай бұрын
Thank youu !
@tanaysrivastava9303
@tanaysrivastava9303 3 ай бұрын
Nice explaination ma'am, but can you further explain the code in upcoming videos ,it would be helpful....
@algorithmsbyaditi
@algorithmsbyaditi 3 ай бұрын
Will improve, Thanks.
@Ayush37262
@Ayush37262 8 ай бұрын
Awesome explanation!!! How to think like that? I was solving this question using a matrix and storing every character in it 😢
@algorithmsbyaditi
@algorithmsbyaditi 8 ай бұрын
Just need to think that the number of strings to be concatenated is equal to the number of rows.
@sushantnand3974
@sushantnand3974 6 ай бұрын
Neetcode faltu me chada rakha h, 2min me samjhaya didi ne, thankss
@algorithmsbyaditi
@algorithmsbyaditi 5 ай бұрын
Thank youu !
@pranawkaushal2932
@pranawkaushal2932 2 ай бұрын
public String convert(String s, int numRows) { if (numRows == 1) return s; // Edge case for a single row StringBuilder[] rows = new StringBuilder[numRows]; for (int i = 0; i < numRows; i++) { rows[i] = new StringBuilder(); } int i = 0; while (i < s.length()) { for (int index = 0; index < numRows && i < s.length(); index++) { rows[index].append(s.charAt(i++)); } for (int index = numRows - 2; index > 0 && i < s.length(); index--) { rows[index].append(s.charAt(i++)); } } StringBuilder sb = new StringBuilder(); for (StringBuilder str : rows) { sb.append(str.toString()); } return sb.toString(); } We can use StringBuilder instead of String for memory optimization
@algorithmsbyaditi
@algorithmsbyaditi 2 ай бұрын
Great work !
@GauravSingh-xs6qn
@GauravSingh-xs6qn 3 ай бұрын
Radhe radhe 😊
@samchopra100
@samchopra100 6 ай бұрын
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 5 ай бұрын
Great work !
@QuadbTech
@QuadbTech 8 ай бұрын
Great explanation 😮
@shivam1gaur
@shivam1gaur 6 ай бұрын
Radhe Radhe
@Viratrohit184
@Viratrohit184 4 ай бұрын
Please make video in English
@meetpatel.47
@meetpatel.47 7 ай бұрын
How many leetcode questions are enough for freshers? your linkedin?
@amanisdreaming3914
@amanisdreaming3914 7 ай бұрын
probably 250-300. also depends on your cognitive skills.
@randomeverything8304
@randomeverything8304 5 ай бұрын
150 are enough. baaki tension lene se kuch nhi hota. Enjoy life.
@meetpatel.47
@meetpatel.47 5 ай бұрын
@@randomeverything8304 gand fati padi he yahape apply karte karte
@surendrasa951
@surendrasa951 6 ай бұрын
mene khud ka code banaya alag uska runtime 15ms aa raha hai submit karne per.
@trendingYT80
@trendingYT80 5 ай бұрын
Kuch samjh mai nahi aaya jo aap samjha rahe ho
@kumarshresth7511
@kumarshresth7511 4 ай бұрын
dhyaan thumbnail pe hoga,to kaha se aayega!
ZigZag Conversion - Leetcode 6 - Python
12:46
NeetCode
Рет қаралды 107 М.
Увеличили моцареллу для @Lorenzo.bagnati
00:48
Кушать Хочу
Рет қаралды 6 МЛН
Каха и лужа  #непосредственнокаха
00:15
World’s strongest WOMAN vs regular GIRLS
00:56
A4
Рет қаралды 39 МЛН
❌ Don't Run Behind 500 LEETCODE Problems ❌ Focus on QPCD
8:31
Programming Languages Tier List 2024
16:18
Neal Wang
Рет қаралды 9 М.
DSA Phir se with Sumeet | Leetcode 6 | Zigzag Conversion
17:54
LeetCode was HARD until I Learned these 15 Patterns
13:00
Ashish Pratap Singh
Рет қаралды 556 М.
ZigZag Conversion - Leetcode 6 - Arrays & Strings (Python)
7:56
Making an Algorithm Faster
30:08
NeetCodeIO
Рет қаралды 143 М.
6. Zigzag Conversion
11:20
Tech Adora by Nivedita
Рет қаралды 16 М.
I Solved 1583 Leetcode Questions  Here's What I Learned
20:37
ThePrimeTime
Рет қаралды 725 М.
Увеличили моцареллу для @Lorenzo.bagnati
00:48
Кушать Хочу
Рет қаралды 6 МЛН