Solved LeetCode program · 996 of 1,000
#1374 · Generate a String With Characters That Have Odd Counts
Original English source
The size is 4. The amount is 4. Keep a shared extra as empty text. Place "z" into extra. If size modulo 2 is 1, set extra to empty text. If size modulo 2 is 0, set amount to size minus 1. The line is empty text.
For every spot from 1 to amount.
Place "p" into line.
Place extra into line. Show line.
Expected stdout
pppz