Why not get flips to the left and right of each index? For each position, number of 1s to the left+number of 0s to the right, then find the minimum over the list. Would take 3 passes, and O(n) space. Of course, less elegant than the optimal solution, but simpler than the backtracking solution imo.
I think most people on the main channel aren't interested in frequent LC videos, so I'd rather post them here. I'll be uploading a different style of video on the main channel from now on. And will upload one sometime tomorrow.
thanks man paused ur video at 2:56 coded myself ac in first go....i really like your way of teaching
Was researching this just an hour ago, you freaky psychic....
The second solution is.. a beauty
It's 6:38 here in Italy. I slept less than 4h and my First thought After watching the request was: "Just count the numbers". Feel like a chad
omg this man never disappoints .sending you good energiesssssss
Neetcode your explanation is an Uff! You are God Sent !
Thank you so much. Amazing explanation.
amazing explanation
This daily series is insane Neetcode!
Thanks, from India!
This series is awesome and helpful
This is such a tricky one to figure out
Fuck this kind of problem. It's really hard to come up optimal solution within 5 mins when you get the question
The second solution was cool
@neetcode wondering what motivated you to create second channel which looks same as first
Much needed. Thanks.
Beautiful second solution
Why not get flips to the left and right of each index? For each position, number of 1s to the left+number of 0s to the right, then find the minimum over the list. Would take 3 passes, and O(n) space.
Of course, less elegant than the optimal solution, but simpler than the backtracking solution imo.
Amazing 🔥🔥
Could you tell me the difference between the previous channel and this channel? Harder problem on this channel? Anyway, I subscribed 🫡
I think most people on the main channel aren't interested in frequent LC videos, so I'd rather post them here.
I'll be uploading a different style of video on the main channel from now on. And will upload one sometime tomorrow.
@@NeetCodeIO yeah
Leetcode videos are nice but the new kind of videos you're making on main channel are fun to watch :)
Keep going sir 🫡
very nice
eternal god
👍👍👍
Bro Pls do leetcode 2062
Awesome explanation