The TransCompilator

Solved LeetCode program · 156 of 1,000

#0164 · Maximum Gap

Medium Array chunk-04.md

Original English source

The numbers is a list of 3, 6, 9, and 1. Sort numbers. The last is the last position of numbers. The best is 0.
For every spot from 1 to last.
The gap is item spot of numbers minus item (spot minus 1) of numbers. If gap is more than best, set best to gap.

Show best.

Open in Playground Browse all 1,000 problems

Expected stdout

3