80% SPACE AND TIME BEATS || C++ || EASY || SIMPLE
\nclass Solution {\npublic:\n    int minOperations(vector<int>& nums) \n    {\n       int moves=0;\n       //first we will sort the array \n       //reazon-->we
```\nclass Solution {\npublic:\n    int minOperations(vector<int>& nums) \n    {\n       int moves=0;\n       //first we will sort the array \n       //reazon-->we will convert the array into increasign array\n       //how->we will increment the curr element and make it bigger than its previous\n\n       //fist 0th index element we will not consider --> nums[i-1] and nums[i] relation  \n\n       //iterate to all the elements from the index1\n       for(int i=1;i<nums.size();i++)\n       {\n           if(nums[i-1]==nums[i])  //duplicate need to increment the nums[i]\n           {\n               moves++;\n               nums[i]=nums[i-1]+1;\n           }\n           else if(nums[i-1]>nums[i]) //nums[i-1] is greater even after sorting beacause we incremented nums[i-1] to make it uniuq from nums[i-2]\n           {\n               moves=moves+abs(nums[i]-nums[i-1])+1;\n               nums[i]=nums[i-1]+1;\n           }\n       }\n       return moves;    \n    }\n};\n```
['C', 'Sorting', 'C++']