educative.io

Instead of window_start = max(window_start, char_index_map[right_char] + 1) why not just set char_index_map = {}

Would it be inappropriate to just set the char_index_map to an empty dictionary as opposed to using the max function? It seems that once we identify a repeat character, and change the window_start any prior index we are tracking is no longer needed since anything prior to window_start is out of the window. It might be less confusing to readers of the code this way.


Type your question above this line.

Course: https://www.educative.io/collection/5668639101419520/5671464854355968
Lesson: https://www.educative.io/collection/page/5668639101419520/5671464854355968/5485010335301632