My easy Java solution


  • 0
    P
        int z=0;
            for(int j=0;j<nums.length;j++)
            {
            	if(target!=0 && nums[j]==target)
            	{
            		z = j;
            	}
            	else if(target!=0 && nums[j]<=target)
            	{
            		z = j+1;
            	}
            	else if(target==0)
            	{
            		z=0;
            	}
            }
            return z;

Log in to reply
 

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