Leetcode - Sort Array By Parity (Python)

preview_player
Показать описание
August 2020 Leetcode Challenge
Leetcode - Sort Array By Parity
Рекомендации по теме
Комментарии
Автор

Found your channel a couple of days ago and I really like it, I have a question, do you come up with the solutions as you record the video? or do you think of them ahead of recording?
It's just that you came up with 3 different solutions in ~2 minutes, and it just seems so damn fast!

Автор

we can also try this easy trick
even=[]
odd=[]
for i in range(len(A)):
if A[i]%2==0:
even.append(A[i])
else:
odd.append(A[i])
result=even+odd
return result

siddharthsingh
Автор

I could only come up with counting sort which would be 3N

almasabdrazak
welcome to shbcf.ru