Posted by : Abdallah Rabie

 Problem Name: Remove Duplicates From Sorted Array 

Platform: leetcode

Link: Remove Duplicates From Sorted Array


As shown as in figure this problem has too much word unless it is very easy and its algorithm is very small lets start. briefly the problem want to remove the duplicated values from array and return the size of new array with some constraint :
  • Without making any space for another array. 
  • To modify the new array to be sorted.
The function has 2 parameter the array , the size  and the returning data type is int. 


The algorithm :
  • Create for loop to go through the whole array and create index variable with finial value 1 to return the array size.
  • Check the first element with the second element if not equal that means that there is no equilty between this two element so store the the n+1 element  in the num index.
  •  Go on for the whole array and return the final array size. 
Bingoo...












Leave a Reply

Subscribe to Posts | Subscribe to Comments

- Copyright © 2025 Quarks - Blogger Templates - Powered by Blogger - Designed by Johanes Djogan -