Special judge: No expected output available.??


  • 0
    E
    class Solution {
    public:
    int findPeakElement(vector<int>& nums) {
        nums.insert(nums.begin(), INT_MIN );
        nums.insert(nums.end(), INT_MIN );
    
        return BinarySearch( nums, 1, nums.size()-3+1 ) -1; //[ a, b ]
    }   
    
    int BinarySearch( vector<int> & nums, int left, int right ){
        int mid = ( left + right ) / 2;
        if( nums[mid] >= nums[mid+1] && nums[mid] >= nums[mid-1] )
            return mid;
    
        if( nums[mid] >= nums[mid-1] )
            return BinarySearch( nums, mid+1, right );
        else
            return BinarySearch( nums, left, mid-1 );
    }   
    };
    

    It is strange that my return 0 is wrong Answer

    Submission Result: Wrong Answer 
    Input:
    [2,1,2]
    Output:
    0
    Expected:
    Special judge: No expected output available.

Log in to reply
 

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