error: expected unqualified-id before string constant???


  • 0
    J

    My code is as follows, it runs great on Xcode and g++. But leetcode give me this:
    error: expected unqualified-id before string constant???
    Any body knows the reason?

    bool canJump(vector<int>& nums) {
        int target = nums.size()-1;
        int current_max = 0;
        for(int i = 0; i <= current_max && i<= target; i++)
        {
            current_max = std::max(nums[i]+i, current_max);
            if(target <= current_max)
                return true;
        }
        return false;
    
    

    }

    • list item

  • 1
    C

    You may missing a semicolon by the end of the class


Log in to reply
 

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