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.
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?
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.
@isht I'm not using global variables. Simply just this one function and all variable are inside the function scope.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.