Contiguous Array (python) - Day 13/30 Leetcode April Challenge

preview_player
Показать описание
Larry solves and analyzes this Leetcode problem as both an interviewer and an interviewee. This is a live recording of a real engineer solving a problem live - no cuts or edits!

#leetcode #coding #python #programming
Рекомендации по теме
Комментарии
Автор

Hey everybody! First medium of the 30 Day challenge! Struggled a bit, as I thought incorrectly that binary search could work - the counterexample being "11000011" - there's a substring of 8 but not 6, so definitely got stuck there. The lesson here is to stay focused, don't get frustrated, and it allowed me to pivot to the dynamic programming solution. Watch on 2x for the explanation at the end, thanks!

Algorithmist
Автор

I'm struggling on how to understand this question... The sample doesn't make any sense.
[0, 1, 0, 1] = 4 // so this is 4, why?
[0, 1, 0, 1, 1] = 4 // this is also 4... so there is some symetry condition??
[0, 0, 1, 0, 0, 0, 1, 1] = 6 // this is 6?? I do not see why. I would have expected 4

officialspock
join shbcf.ru