What's the n means in "Search in Rotated Sorted Array"

  • 0
    1. There is "int n" in the search function in class Solution. So I don't know the meaning of "n".
    2. How to distinguish the integer number 0 and the end sign '\0'. For example, ch1[]={1,2,3,0} and ch2={1,2,3}.

  • 1
    1. n only shows up for C++, since it has to give the length of array in C++.

    2. No need to worry about the \0. It is only available when the array is a char array. In this problem, it is an int array.

Log in to reply

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