Welcome to AlgoYogi!
🚀 Start Your Smart Coding Prep at 👉 https://algoyogi.io
We solve LeetCode 2264: Largest 3-Same-Digit Number in String using a simple one-pass scan.
Goal: find the maximum valued substring of length 3 made of the same digit. If none exists, return an empty string.
Approach:
- Walk the string once while tracking the current run length of the same digit.
- Each time a run reaches length 3, record the digit as a candidate.
- Keep the largest digit seen among such triples and return that digit repeated three times.
- If no triple is found, return an empty string.
👉 Problem Link: https://leetcode.com/problems/largest-3-same-digit-number-in-string/description/
---
### ⏱ Timestamps
0:00 Introduction
0:20 Problem Statement
1:50 One-Pass Run-Length Approach
6:00 Python Code Walkthrough
8:30 Time and Space Complexity
---
### 💡 Why Watch?
- Clean linear scan, constant space
- Handles overlapping runs naturally
- Interview-friendly string pattern technique
#LeetCode #LargestThreeSameDigit #Python #AlgoYogi #StringScan
Download
0 formats
No download links available.
LeetCode 2264 | Largest 3-Same-Digit Number in String | Python One-Pass Scan | AlgoYogi | NatokHD