The TransCompilator

Solved LeetCode program · 35 of 1,000

#0035 · Search Insert Position

Easy Array chunk-01.md

Original English source

Start with the list of numbers 1, 3, 5, and 6. The target is 5. The count is the number of items in numbers. The foundposition is -1.
For every position from 0 to the last position of numbers.
If item position of numbers is target or item position of numbers is more than target, set foundposition to position, report foundposition, then stop.

If foundposition is -1, report count.

Open in Playground Browse all 1,000 problems

Expected stdout

2