The example in the problem seems to be wrong.


  • 2
    O
    Input: 6
    Output: 3
    Explanation: The first 6 elements of magical string S is "12211" and it contains three 1's, so return 3.
    

    Shouldn't it be first 5 elements (12211) instead of 6? Am I stupid?


  • 0
    J

    You are correct, of course.


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.