Why output: "Line 32: 'class Solution' has no member named 'canJump' "


  • 0
    R
    class Solution {
    public:
        bool jump(int A[], int n)
    {
        if(n==0) return true;
    	int last=0,cur=0,ret=0;
    	for(int i=0;i<n;i++)
    	{
    		if(i>last)
    		{
    			if(cur==last)
    				return false;
    			last=cur;
    			ret++;
    		}
    		if(cur<i+A[i])
    			cur=i+A[i];
    	}
    	if(ret>0)
    	    return true;
    	else 
    	    return false;
    }
    };
    

    I see the posts for greedy algorithm, and jumpgame II ac, but this not. As it output strange compile error, I don't know what happened...


  • 0
    S

    Take a look at default code in editor:

    class Solution {
    public:
        bool canJump(int A[], int n) {  // implement canJamp function instead of jump
            
        }
    };

  • 0
    R

    thks : ) what a stupid mistake I made!


Log in to reply
 

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