The TransCompilator

Solved LeetCode program · 676 of 1,000

#0908 · Smallest Range I

Easy Array chunk-14.md

Original English source

The numbers is a list of 0 and 10. The slack is 2. The last is the last position of numbers. The lowest is item 0 of numbers. The highest is item 0 of numbers.
For every spot from 1 to last.
If item spot of numbers is less than lowest, set lowest to item spot of numbers. If item spot of numbers is more than highest, set highest to item spot of numbers.

The spread is highest minus lowest. Decrease spread by 2 times slack. If spread is less than 0, set spread to 0. Show spread.

Open in Playground Browse all 1,000 problems

Expected stdout

6