- Популярные видео
- Авто
- Видео-блоги
- ДТП, аварии
- Для маленьких
- Еда, напитки
- Животные
- Закон и право
- Знаменитости
- Игры
- Искусство
- Комедии
- Красота, мода
- Кулинария, рецепты
- Люди
- Мото
- Музыка
- Мультфильмы
- Наука, технологии
- Новости
- Образование
- Политика
- Праздники
- Приколы
- Природа
- Происшествия
- Путешествия
- Развлечения
- Ржач
- Семья
- Сериалы
- Спорт
- Стиль жизни
- ТВ передачи
- Танцы
- Технологии
- Товары
- Ужасы
- Фильмы
- Шоу-бизнес
- Юмор
58. Length of Last Word | LeetCode Easy | C++ Solution
Problem Name: 58. Length of Last Word
In this video, I solved LeetCode 58 “Length of Last Word” using C++ with an easy step-by-step explanation.
📌 Problem Statement:
Given a string s, return the length of the last word in the string.
📌 Approach Used:
- Start from the end of the string
- Ignore spaces at the end
- Count characters of the last word
- Stop when a space comes after counting starts
- Return the count
📌 Example:
Input:
s = "Hello World"
Output:
5
Explanation:
The last word is "World", and its length is 5.
📌 Concepts Covered:
✅ Strings
✅ Loops
✅ Reverse Traversal
✅ Conditions
✅ Time & Space Complexity
📌 Time Complexity:
O(n)
📌 Space Complexity:
O(1)
📌 Language Used:
C++
🔗 GitHub:
https://github.com/amankumar1508
🔗 LinkedIn:
https://www.linkedin.com/in/aman-kumar-067825379
🔗 Portfolio:
https://aman-kumar-dev-portfolio.vercel.app
🔗 LeetCode Profile:
https://leetcode.com/u/OVzm6rcAP2/
#leetcode
#cplusplus
#cpp
#leetcode58
#string
#dsa
#coding
#programming
Видео 58. Length of Last Word | LeetCode Easy | C++ Solution канала Aman Kumar
In this video, I solved LeetCode 58 “Length of Last Word” using C++ with an easy step-by-step explanation.
📌 Problem Statement:
Given a string s, return the length of the last word in the string.
📌 Approach Used:
- Start from the end of the string
- Ignore spaces at the end
- Count characters of the last word
- Stop when a space comes after counting starts
- Return the count
📌 Example:
Input:
s = "Hello World"
Output:
5
Explanation:
The last word is "World", and its length is 5.
📌 Concepts Covered:
✅ Strings
✅ Loops
✅ Reverse Traversal
✅ Conditions
✅ Time & Space Complexity
📌 Time Complexity:
O(n)
📌 Space Complexity:
O(1)
📌 Language Used:
C++
🔗 GitHub:
https://github.com/amankumar1508
🔗 LinkedIn:
https://www.linkedin.com/in/aman-kumar-067825379
🔗 Portfolio:
https://aman-kumar-dev-portfolio.vercel.app
🔗 LeetCode Profile:
https://leetcode.com/u/OVzm6rcAP2/
#leetcode
#cplusplus
#cpp
#leetcode58
#string
#dsa
#coding
#programming
Видео 58. Length of Last Word | LeetCode Easy | C++ Solution канала Aman Kumar
Комментарии отсутствуют
Информация о видео
15 ч. 18 мин. назад
00:04:29
Другие видео канала




















