LeetCode - 1446. Consecutive Characters | Day 13 December Challenge
Aditya Mahajan
Problem: https://leetcode.com/problems/consecutive-characters/ Code Link: https://github.com/skystone1000/LeetCode
December Challenge 2021 - Day 13 1446. Consecutive Characters
TIMESTAMPS 0:00 Intro 0:19 Question 1:18 Approach 1 - Brute force 2:25 Approach 1 - Code 3:27 Approach 2 - One Pass 4:31 Approach 2 - Code 6:22 Approach 3 - Sliding Window 7:45 Approach 3 - Code 9:45 Output
Approach We need to calculate the power of string which in short is the max substring that has same character so a simple and optimized way would be to do a single traversal and maintain 2 variables one for power(which would be our ans) and the other for iteration max(currMax) and the increment currMax when we have the same character and update the power when we encounter a diff character and reset currMax
š Social Media š
š LinkedIn: https://www.linkedin.com/in/adityamahajan123/ š GitHub: https://github.com/skystone1000/ šø Instagram: https://www.instagram.com/skystone1000/ š Chess.com : https://www.chess.com/member/skystone1000 ā Discord Server: https://discord.gg/ZPWzT5QWDC
ā” Please leave a LIKE and SUBSCRIBE for more content! ā”
ā Tags ā
- Aditya Mahajan
ā Hashtags ā #leetcode #1306Leetcode ... https://www.youtube.com/watch?v=UDQLWSO0tj0
60326093 Bytes