Anyone wants to help me out with a weird bug?


  • 0
    L

    When I just simply run with "aab" as a costumized test case, it returns 2, but when I submit the code it returns 1, I don't know why, my code seems fine.

    0_1500672816968_What_is_this.png


  • 0
    L

    I ran my code with this test case on my local machine with c99 standard, it gives me 2. WHAT WAS HAPPENING ON LEETCODE SERVER?


  • 0
    I

    Are you using global variables? If yes, then that is the reason for this. Global variables do not reset after a function call. For each test case, a function call is made.


  • 0
    L

    @isht I'm not using global variables. Simply just this one function and all variable are inside the function scope.


Log in to reply
 

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