- Популярные видео
- Авто
- Видео-блоги
- ДТП, аварии
- Для маленьких
- Еда, напитки
- Животные
- Закон и право
- Знаменитости
- Игры
- Искусство
- Комедии
- Красота, мода
- Кулинария, рецепты
- Люди
- Мото
- Музыка
- Мультфильмы
- Наука, технологии
- Новости
- Образование
- Политика
- Праздники
- Приколы
- Природа
- Происшествия
- Путешествия
- Развлечения
- Ржач
- Семья
- Сериалы
- Спорт
- Стиль жизни
- ТВ передачи
- Танцы
- Технологии
- Товары
- Ужасы
- Фильмы
- Шоу-бизнес
- Юмор
LeetCode 58: Length of Last Word | Simple String Traversal Explained
In this video, we solve **LeetCode 58 – Length of Last Word** using a clean and efficient string traversal approach.
We iterate from the end of the string to directly find the last word and calculate its length.
---
💡 **What You’ll Learn**
• How to traverse strings from the end
• Ignoring trailing spaces efficiently
• Finding the last word without extra storage
• Time & Space Complexity explained clearly
---
🧠 **Concepts Covered**
• Strings
• Traversal techniques
• Edge case handling
• Efficient iteration logic
---
📌 **Problem Summary**
Given a string consisting of words and spaces, return the length of the last word in the string.
A word is defined as a sequence of non-space characters.
---
⚡ **Approach Used in This Video**
We start traversing the string from the back:
• First, skip all trailing spaces
• Then count characters until another space is found
The count gives the length of the last word.
---
⏱ **Complexity**
Time Complexity: O(n)
Space Complexity: O(1)
---
🎯 **Why This Matters**
This problem helps you:
• Improve string manipulation skills
• Handle edge cases cleanly
• Build efficient traversal logic for interviews
---
🔗 **Connect With Me**
GitHub: https://github.com/Ritesh007-max
Twitter (X): https://x.com/RiteshGabale007
LinkedIn: https://www.linkedin.com/in/ritesh-gabale-59a2b5365/
Portfolio: https://ritesh-portfolio-v06.netlify.app/
---
📈 **Tags**
#leetcode #dsa #strings #codinginterview #programming #cplusplus
---
👍 Like & Subscribe for daily LeetCode problem-solving videos.
Видео LeetCode 58: Length of Last Word | Simple String Traversal Explained канала Ritesh
We iterate from the end of the string to directly find the last word and calculate its length.
---
💡 **What You’ll Learn**
• How to traverse strings from the end
• Ignoring trailing spaces efficiently
• Finding the last word without extra storage
• Time & Space Complexity explained clearly
---
🧠 **Concepts Covered**
• Strings
• Traversal techniques
• Edge case handling
• Efficient iteration logic
---
📌 **Problem Summary**
Given a string consisting of words and spaces, return the length of the last word in the string.
A word is defined as a sequence of non-space characters.
---
⚡ **Approach Used in This Video**
We start traversing the string from the back:
• First, skip all trailing spaces
• Then count characters until another space is found
The count gives the length of the last word.
---
⏱ **Complexity**
Time Complexity: O(n)
Space Complexity: O(1)
---
🎯 **Why This Matters**
This problem helps you:
• Improve string manipulation skills
• Handle edge cases cleanly
• Build efficient traversal logic for interviews
---
🔗 **Connect With Me**
GitHub: https://github.com/Ritesh007-max
Twitter (X): https://x.com/RiteshGabale007
LinkedIn: https://www.linkedin.com/in/ritesh-gabale-59a2b5365/
Portfolio: https://ritesh-portfolio-v06.netlify.app/
---
📈 **Tags**
#leetcode #dsa #strings #codinginterview #programming #cplusplus
---
👍 Like & Subscribe for daily LeetCode problem-solving videos.
Видео LeetCode 58: Length of Last Word | Simple String Traversal Explained канала Ritesh
Комментарии отсутствуют
Информация о видео
12 мая 2026 г. 23:30:11
00:04:42
Другие видео канала




















