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.
man.. ur making sense even to me ...i'm the guy who started coding from last two months...thanks for the content
You are an undiscovered treasure of youtube.
Thanks. =)
I know your views are very low but you are very precious for data science.
Thanks man, your initial assesment made me create a solution before watching the real code in your video.
Man I thought it is 1B but it was 18 views
Wish you the best
I loved how you explained it so easily. Thank you so much :)
finally understood this zigzag problem's solution
i loved the way you approach to the problems solving in recursion - can you make a videos that will explain deeply in recursion pls
What an elegant solution!
Solid video
Very nice explanation
Best Technique !!! thanks for the video :)
The content is awesome and deserving of more love
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.
Was stuck at this problem for 3 hrs , now i feel foolish😅. Thanks for such a good explination
You're a legend!
Thank you very much.
brilliant solution, thanks for sharing! :)