The TransCompilator

Solved LeetCode program · 128 of 1,000

#0128 · Longest Consecutive Sequence

Medium Array chunk-03.md

Original English source

The numbers is a list of 100, 4, 200, 1, 3, and 2. Sort numbers. The last is the last position of numbers. The best is 1. The run is 1.
For every spot from 1 to last.
The current is item spot of numbers. The before is item (spot minus 1) of numbers. If current is before plus 1, add 1 to run. If current is not before and current is not before plus 1, set run to 1. If run is more than best, set best to run.

Show best.

Open in Playground Browse all 1,000 problems

Expected stdout

4