The TransCompilator

Solved LeetCode program · 862 of 1,000

#1163 · Last Substring in Lexicographical Order

Hard String chunk-18.md

Original English source

The text is "abab". The last is the last position of text. The best is the slice of text from 0 to last plus 1.
For every start from 1 to last.
The candidate is the slice of text from start to last plus 1. The better is 0. If best comes before candidate, set better to 1. If better is 1, Set best to a copy of candidate.

Show best.

Open in Playground Browse all 1,000 problems

Expected stdout

bab