Re: [My Solution : Time O(n)](Space O(1))

class Solution {

public int removeDuplicates(int[] nums) {

if(nums.length == 0)

return 0;

int len = nums.length;

int num = 1;

int i = 0;

while(i < (len-1)){

if(nums[i] < nums[i + 1])

{

num++;

}

i++;

}

return num;

}

}