class Solution {
public:
int largestPerimeter(vector<int>& nums) {
sort(nums.begin(),nums.end());
for(int i=nums.size()-3;i>=0;i--)
{
if(nums[i]+nums[i+1]>nums[i+2])
return nums[i] + nums[i+1] + nums[i+2];
}
return 0;
}
};
Code Example |
---|
Cpp :: kruskal algorithm in c++ |
Cpp :: _ZNSolsEi |
Cpp :: typeid to string c++ |
Cpp :: Marin and Anti-coprime Permutation codeforces solution in c++ |
Cpp :: sum of 2 arrays c++ |
Cpp :: are maps sorted c++ |
Cpp :: Integer Literrals in C++ Programming |
Cpp :: lcm recursive program in c++ |
Cpp :: jquery ajax post json asp.net core |
Cpp :: c++ max |
Cpp :: what is c++ function |
Cpp :: c++ find in pair |
Cpp :: fenwick tree |
Cpp :: for statement in c++ |
Cpp :: how to change the type of something in c++ |
Cpp :: c++ return statement |
Cpp :: c++ function with parameters |
Cpp :: how to find maximum value in c++ |
C :: generate n-bit gray code in c |
C :: get pid c |
C :: haskell print |
C :: sdl draw Rectf |
C :: Creating a process in C |
C :: successeur d’un entier donné |
C :: search array element in c |
C :: c fractional sleep |
C :: c static variables |
C :: c program for swapping of two numbers using temporary variable |
C :: limit axis in one direction plt |
C :: C Programming to swap two variables |