The TransCompilator

Solved LeetCode program · 515 of 1,000

#0724 · Find Pivot Index

Easy Array chunk-11.md

Original English source

The numbers is a list of 1, 7, 3, 6, 5, and 6. The whole is 0.
For each value in numbers.
Add value to whole.

The left is 0. The answer is -1.
For every spot from 0 to the last position of numbers.
The rest is whole minus left minus item spot of numbers. If left is rest and answer is -1, set answer to spot. Increase left by item spot of numbers.

Show answer.

Open in Playground Browse all 1,000 problems

Expected stdout

3