The TransCompilator

Solved LeetCode program · 624 of 1,000

#0852 · Peak Index in a Mountain Array

Medium Array chunk-13.md

Original English source

The heights is a list of 0, 10, 5, 2, and 1. The low is 0, while the high is the last position of heights.
Repeat while low is less than high.
The middle is (low plus high) divided by 2. If item middle of heights is less than item (middle plus 1) of heights, set low to middle plus 1. If item middle of heights is more than item (middle plus 1) of heights, set high to middle.

Show low.

Open in Playground Browse all 1,000 problems

Expected stdout

1