The TransCompilator

Solved LeetCode program · 3 of 1,000

#0003 · Longest Substring Without Repeating Characters

Medium String chunk-01.md

Original English source

The word is "abcabcbb". The last is the last position of word. The best is 0.
For every start from 0 to last.
For every finish from start to last.
The repeated is 0. For every earlier from start to one less than finish, if character earlier of word is character finish of word, add 1 to repeated. The span is finish minus start plus 1. If repeated is 0 and span is greater than best, set best to span.

Show best.

Open in Playground Browse all 1,000 problems

Expected stdout

3