Easy O(n) Solution //Begginer Friendly;
Intuition\nJust use the max occuring diff and check if any less is present or not.\n\n# Approach\nSort the array and take the max difference and check while ite
# Intuition\nJust use the max occuring diff and check if any less is present or not.\n\n# Approach\nSort the array and take the max difference and check while iterating over the loop.\n\n# Complexity\n- Time complexity:\nO(n)\n\n- Space complexity:\nO(1)\n\n# Code\n```\nclass Solution {\npublic:\n    int findValueOfPartition(vector<int>& nums) {\n        sort(nums.begin(),nums.end());\n        int n=nums.size();\n        int dif=nums[n-1]-nums[n-2];\n        for(int i=1;i<n;i++){\n            dif=min(dif,nums[i]-nums[i-1]);\n        }\n        return dif;\n    }\n};\n```
['C++']