I think an important thing to sort of internalize is that when you insert a parity into the hashmap, you are guaranteed that this is the earliest index at which this parity is found. So everytime you encounter this parity again, you are comparing it with the earliest index you encountered this parity, which gives you the longest length as i keeps increasing. Thanks for the great video, took a little while to digest but seems to be very helpful in solving problems with a similar recurring pattern!
I think an important thing to sort of internalize is that when you insert a parity into the hashmap, you are guaranteed that this is the earliest index at which this parity is found. So everytime you encounter this parity again, you are comparing it with the earliest index you encountered this parity, which gives you the longest length as i keeps increasing. Thanks for the great video, took a little while to digest but seems to be very helpful in solving problems with a similar recurring pattern!
best explanation sir. thanks you so much
Nice explanation, tricky to get the insight to check for parity. I used a stringbuilder as my bitmask because it was simpler to deal with.
Loved the solution
Beautiful explanation
Great solution
I didn't understand it 😔