The TransCompilator

Solved LeetCode program · 707 of 1,000

#0942 · DI String Match

Easy Array chunk-15.md

Original English source

The pattern is "IDID". The size is the number of characters in pattern. The low is 0. The high is size. The answers is an empty list of whole numbers.
For every spot from 0 to size minus 1.
If character spot of pattern is "I", place low into answers, add 1 to low. If character spot of pattern is "D", place high into answers, set high to high minus 1.

Place low into answers. For each answer in answers, show answer.

Open in Playground Browse all 1,000 problems

Expected stdout

0
4
1
3
2