log, one character per event in time order: 'E' means a car drove in and took a spot, 'L' means a car drove out and freed one. The lot starts empty, and the log is consistent: only a car that is parked can leave.
Return the smallest number of spots that guarantees every arriving car finds a free one.log="EELEL" → 2
After the second event two cars are inside, and there are never more at once.
log="EEE" → 3
Three cars came in and none left.
log="ELELEL" → 1
Cars come and go one at a time, so a single spot is enough.
log consists only of 'E' and 'L'log="EELEL"
2
Run checks the first 3 tests in your browser. Submit checks all 69 tests on the server, hidden ones included.