The TransCompilator

Solved LeetCode program · 807 of 1,000

#1044 · Longest Duplicate Substring

Hard String chunk-17.md

Original English source

The source is "banana". The last is the last position of source. The found is 0. The answer is empty text.
For every step from 1 to last.
The span is last plus 1 minus step.
For every first from 0 to last plus 1 minus span.
For every second from first plus 1 to last plus 1 minus span.
The leftpiece is the slice of source from first to first plus span. The rightpiece is the slice of source from second to second plus span. If leftpiece matches rightpiece, set answer to leftpiece, set found to 1, stop. If found is 1, stop. If found is 1, stop.

Show answer.

Open in Playground Browse all 1,000 problems

Expected stdout

ana