The TransCompilator

Solved LeetCode program · 997 of 1,000

#1375 · Number of Times Binary String Is Prefix-Aligned

Medium Array chunk-20.md

Original English source

The flips is a list of 3, 2, 4, 1, and 5. The size is 5. Keep a shared seen as an empty list of whole numbers.
For every spot from 0 to 5.
Place 0 into seen.

The highest is 0. The moments is 0.
For every step from 0 to size minus 1.
The flip is item step of flips. Set item flip of seen to 1. If flip is more than highest, set highest to flip. If highest is step plus 1, add 1 to moments.

Show moments.

Open in Playground Browse all 1,000 problems

Expected stdout

2