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.
Was researching this just an hour ago, you freaky psychic....
thanks man paused ur video at 2:56 coded myself ac in first go....i really like your way of teaching
The second solution is.. a beauty
omg this man never disappoints .sending you good energiesssssss
Neetcode your explanation is an Uff! You are God Sent !
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
amazing explanation
Thank you so much. Amazing explanation.
This series is awesome and helpful
The second solution was cool
This is such a tricky one to figure out
Beautiful second solution
Much needed. Thanks.
@neetcode wondering what motivated you to create second channel which looks same as first
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 🔥🔥
This daily series is insane Neetcode!
Thanks, from India!
Fuck this kind of problem. It's really hard to come up optimal solution within 5 mins when you get the question
very nice
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 🫡
Bro Pls do leetcode 2062
👍👍👍
eternal god
Awesome explanation