Python Programming Practice: LeetCode #6 -- ZigZag Conversion

preview_player
Показать описание
This episode of Python Programming Practice shows two approaches to LeetCode #6 -- ZigZag Conversion

This is a medium difficulty problem.

Note that the intent of this series to help viewers think through approaches to problems, not to provide copy/paste access to code that will pass LeetCode tests.
Рекомендации по теме
Комментарии
Автор

man.. ur making sense even to me ...i'm the guy who started coding from last two months...thanks for the content

johnbanyan
Автор

You are an undiscovered treasure of youtube.

neotank
Автор

I know your views are very low but you are very precious for data science.

karamanabdullah
Автор

Thanks man, your initial assesment made me create a solution before watching the real code in your video.

fnfal
Автор

I loved how you explained it so easily. Thank you so much :)

devashreesharma
Автор

Man I thought it is 1B but it was 18 views
Wish you the best

sady_
Автор

finally understood this zigzag problem's solution

manh
Автор

i loved the way you approach to the problems solving in recursion - can you make a videos that will explain deeply in recursion pls

tubex
Автор

The content is awesome and deserving of more love

vishalsinghsengar
Автор

Best Technique !!! thanks for the video :)

yashm
Автор

Was stuck at this problem for 3 hrs, now i feel foolish😅. Thanks for such a good explination

MJ-qrxw
Автор

brilliant solution, thanks for sharing! :)

Lumary
Автор

I wouldn't have bothered with the intermediate form. Easier just to change one string into the other. Less lines of code.
'''
def zigzag(in_s, row_count, col_count):
in_s_len, out_s, i = len(in_s), "", 0
for col in range(col_count):
for row in range(row_coun)t:
if col % 2 or not row % 2:
out_s += in_s[i]
i += 1
return out_s
'''
God coding on your phone is painful... Zero chance there isn't a bug there but hopefully you get the idea.

I just loop the rows and treat the even and odd ones differently.

sidehat