start
and max_length
, to 0.i
.i
is in the hashmap and its stored index is greater than or equal to start
, update start
to the stored index + 1.i
.max_length
to the maximum of max_length
and i - start + 1
.max_length
after the iteration.