The TransCompilator

Solved LeetCode program · 455 of 1,000

#0643 · Maximum Average Subarray I

Easy Array chunk-10.md

Original English source

The numbers is a list of 1, 12, -5, -6, 50, and 3. The width is 4. The last is the last position of numbers. The window is 0.
For every spot from 0 to width minus 1.
Increase window by item spot of numbers.

The best is window.
For every start from 1 to last minus width plus 1.
Decrease window by item (start minus 1) of numbers. Increase window by item (start plus width minus 1) of numbers. If window is more than best, set best to window.

The integer is best divided by width. The rest is best modulo width. The parts is an empty list of text. The headtext is format whole number integer as text. Place headtext into parts. Place "." into parts.
For every digit from 0 to 4.
Set rest to rest times 10. The piece is rest divided by width. The pad is format whole number piece as text. Place pad into parts. Set rest to rest modulo width.

The line is join parts with "". Show line.

Open in Playground Browse all 1,000 problems

Expected stdout

12.75000