- Популярные видео
- Авто
- Видео-блоги
- ДТП, аварии
- Для маленьких
- Еда, напитки
- Животные
- Закон и право
- Знаменитости
- Игры
- Искусство
- Комедии
- Красота, мода
- Кулинария, рецепты
- Люди
- Мото
- Музыка
- Мультфильмы
- Наука, технологии
- Новости
- Образование
- Политика
- Праздники
- Приколы
- Природа
- Происшествия
- Путешествия
- Развлечения
- Ржач
- Семья
- Сериалы
- Спорт
- Стиль жизни
- ТВ передачи
- Танцы
- Технологии
- Товары
- Ужасы
- Фильмы
- Шоу-бизнес
- Юмор
Lettcode 611 | Valid Triangle Number | Daily Leetcode | POTD
Just trying to solve this question using bruteforce and then after tle trying to do some optimization to get the question submitted.
#leetcode #coding #c++
#potd We will sort the given points to remove some redundancy.
We sequentially check using three pointers by passing them into a check_triangle function, and if the function returns true, we increase the counter. If it returns false, then we break the innermost k loop, as going forward makes no sense since the array is sorted. This removes some redundancy.
The check_triangle function uses the fact that the sum of two sides of a triangle is greater than the third side to check whether the given three sides form a triangle or not.
As the array is sorted, we just need to check one combination of the given three parameters in the check_triangle function, that is, whether the first + second is greater than third.
Видео Lettcode 611 | Valid Triangle Number | Daily Leetcode | POTD канала DSA - Just Intuition
#leetcode #coding #c++
#potd We will sort the given points to remove some redundancy.
We sequentially check using three pointers by passing them into a check_triangle function, and if the function returns true, we increase the counter. If it returns false, then we break the innermost k loop, as going forward makes no sense since the array is sorted. This removes some redundancy.
The check_triangle function uses the fact that the sum of two sides of a triangle is greater than the third side to check whether the given three sides form a triangle or not.
As the array is sorted, we just need to check one combination of the given three parameters in the check_triangle function, that is, whether the first + second is greater than third.
Видео Lettcode 611 | Valid Triangle Number | Daily Leetcode | POTD канала DSA - Just Intuition
Комментарии отсутствуют
Информация о видео
26 сентября 2025 г. 16:55:13
00:21:44
Другие видео канала




















