Problem D
Swipe to start coding
Given an integer array nums
of possible sides lengths. Return the largest perimeter of the triangle that can be reached by combining these lengths. If there is no such a perimeter, return 0.
Example 1
Input: nums
= [6, 3, 2, 3, 1, 9, 7]
Output: 22. Use lengths 6, 7 and 9.
Example 2
Input: nums = [4, 1, 5, 9]
Output: 0. There is no possible triangle, you can't use 4, 5, and 9, for example.
Example 3
Input: nums = [7, 15, 7, 7, 6]
Output: 21. Use 7, 7, 7.
Solution
Merci pour vos commentaires !
single
Demandez à l'IA
Demandez à l'IA
Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion
Résumer ce chapitre
Expliquer le code dans file
Expliquer pourquoi file ne résout pas la tâche
Awesome!
Completion rate improved to 7.69
Problem D
Glissez pour afficher le menu
Swipe to start coding
Given an integer array nums
of possible sides lengths. Return the largest perimeter of the triangle that can be reached by combining these lengths. If there is no such a perimeter, return 0.
Example 1
Input: nums
= [6, 3, 2, 3, 1, 9, 7]
Output: 22. Use lengths 6, 7 and 9.
Example 2
Input: nums = [4, 1, 5, 9]
Output: 0. There is no possible triangle, you can't use 4, 5, and 9, for example.
Example 3
Input: nums = [7, 15, 7, 7, 6]
Output: 21. Use 7, 7, 7.
Solution
Merci pour vos commentaires !
Awesome!
Completion rate improved to 7.69single