Largest Perimeter Triangle | | Faster than 97% | | 3 Pointers C++
Intuition\nThe basic intuition was to sort the array and check the elements from the end. If the sum of last second and last third element is greater than last 
# Intuition\nThe basic intuition was to sort the array and check the elements from the end. If the sum of last second and last third element is greater than last element, then return the sum of all last three elements, else decrement all pointers by 1.\n\n# Complexity\n- Time complexity:\n$$O(n)$$\n\n- Space complexity:\n$$O(1)$$\n\n# Code\n```\nclass Solution {\npublic:\n    int largestPerimeter(vector<int>& nums) {\n        sort(nums.begin(), nums.end());\n        int size = nums.size();\n        int a = size - 3, b = size - 2, c = size - 1;\n\n        while(a >= 0){\n            if(nums[a] + nums[b] > nums[c]) return nums[a] + nums[b] + nums[c];\n            else{\n                a--;\n                b--;\n                c--;\n            }\n        }\n\n        return 0;\n    }\n};\n```
['C++']