🚀 Day 32/60 — LeetCode Discipline Problem Solved: Find the Index of the First Occurrence in a String Difficulty: Easy Today’s problem was about locating a substring within a string — a classic example of pattern searching. Using a straightforward approach, I iterated through the string and checked each possible starting point where the substring could match. This reinforces how simple logic, when applied cleanly, can be highly effective. 💡 Focus Areas: • Strengthened understanding of string traversal • Practiced substring comparison • Improved handling of boundary conditions • Learned importance of index-based iteration • Focused on writing clean and readable code ⚡ Performance Highlight: Achieved 0 ms runtime (100% performance) Sometimes the answer isn’t hidden deep — it’s right there… waiting for a careful eye to notice it. #LeetCode #60DaysOfCode #100DaysOfCode #DSA #Strings #Algorithms #ProblemSolving #CodingJourney #SoftwareEngineering #Python #Developers #Consistency #TechGrowth
LeetCode Day 32: Finding Substring Index in a String
More Relevant Posts
-
Today: LeetCode 88 — Merge Sorted Array. Saw "sorted arrays" in the problem. My brain immediately said: two pointers. Started coding. Got stuck pretty fast. The issue? When you're merging into an existing array without extra space, two pointers aren't enough — you need a third one tracking where to place elements. And you have to go backwards through nums1, or you'll overwrite values you still need. Took longer than I'd like to admit. Used hints. Eventually got it — and it beat 100% on runtime. The real lesson wasn't the algorithm. It was this: pattern recognition gets you to the door, but you still have to figure out which version of the pattern fits. "Two pointers" is a family of techniques, not a single move. Knowing the name isn't the same as understanding the shape of the problem. Day 36 of #1000DaysOfLearning #DSA #Python #LearningInPublic
To view or add a comment, sign in
-
-
🚀 Day 7 – LeetCode Journey Today’s problem: String to Integer (atoi) This one really tested my understanding of edge cases and string parsing. Not just coding, but thinking like a machine step-by-step 👇 ✅ Ignored leading whitespaces ✅ Handled positive & negative signs ✅ Extracted numbers until non-digit appears ✅ Managed overflow within 32-bit integer range At first, it looked simple… but the edge cases made it interesting 😅 💡 Key Learning: Writing code is one thing, but handling all possible inputs correctly is what truly matters in real-world problems. Slowly getting better at breaking down problems and building clean logic 💻🔥 On to Day 8… 🚀 #Day7 #LeetCode #CodingJourney #Python #ProblemSolving #Consistency #LearningEveryday
To view or add a comment, sign in
-
-
🚀 Day 75 of #100DaysOfCode 🔥 LeetCode 179 – Largest Number 💡 Problem: Given a list of non-negative integers, arrange them such that they form the largest possible number. 🧠 Key Insight: Normal sorting won't work here ❌ We need a custom comparator based on string concatenation. 👉 Compare: - ""a + b"" vs ""b + a"" - Whichever gives a larger value should come first. ⚙️ Approach: 1. Convert numbers to strings 2. Sort using custom comparison logic 3. Join the result 4. Handle edge case (like "[0,0] → "0"") ⚡ Complexity: - Time: O(n log n) - Space: O(n) 🎯 Result: ✅ Accepted ⚡ Runtime: 0 ms (100%) 📌 Lesson Learned: Sometimes sorting logic depends on combination, not value. #LeetCode #Python #CodingJourney #DSA #100DaysOfCode #Sorting #ProblemSolving
To view or add a comment, sign in
-
-
Just solved “Second Largest Digit in a String” on LeetCode — and here’s the simple approach I followed 👇 Instead of overcomplicating it, I focused on clean thinking + Python basics: 🔹 Converted the string into a set → removes duplicates instantly 🔹 Filtered only digits using isdigit() 🔹 Stored them as integers in a list 🔹 Sorted the list → easy access to largest & second largest 🔹 Edge case check: if less than 2 digits → return -1 💡 Key takeaway: Sometimes the most optimal solution isn’t about complex algorithms — it’s about using the right built-in tools smartly. 🚀 What I’m improving with each problem: • Writing cleaner logic • Thinking in steps instead of rushing • Handling edge cases early Consistency > Complexity. #LeetCode #DSA #Python #ProblemSolving #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
Most FastAPI codebases look clean at first glance. Until you try to change something. I’ve noticed a pattern — a lot of complexity doesn’t come from the problem itself, but from where the logic lives. When routes start handling more than just request/response, things get harder to reason about. Lately, I’ve been keeping one constraint: Routes should stay thin. They handle the HTTP layer. All business logic moves to services. It’s a small shift, but it changes a lot: 1) Clearer separation of concerns 2) Easier testing 3) Fewer side effects when making changes Also started appreciating dependency injection more. Not as a framework feature, but as a way to keep things decoupled and predictable. Nothing groundbreaking here. But in a time where a lot of code is being generated faster than it’s being designed, maintainability comes down to how consistently we apply these basics — not whether we know them. Curious how others approach structuring FastAPI projects at scale. #FastAPI #BackendDevelopment #CleanCode #SoftwareEngineering #Python
To view or add a comment, sign in
-
Day 3 / 100 🚀 Solved “Reverse Integer” — a problem that looks simple but actually tests how carefully you handle edge cases. At first, reversing digits feels straightforward. But the real challenge is handling 32-bit overflow without using extra space. 💡 Key learning: Before updating the result, always check if multiplying by 10 will exceed the allowed range. Core idea: rev * 10 + digit must stay within [-2³¹, 2³¹ - 1] Highlights: • Time Complexity: O(log n) • Space Complexity: O(1) • Correctly handles negative numbers and overflow This problem reinforced a critical habit: Don’t just make the logic work — validate boundary conditions. #100DaysOfCode #LeetCode #DSA #Python #ProblemSolving #CodingInterview
To view or add a comment, sign in
-
-
🚀 Day 38 – LeetCode Journey Today’s problem: Gray Code ✔️ Generated sequence using bit manipulation ✔️ Applied formula: "i ^ (i >> 1)" ✔️ Ensured only one bit changes between consecutive numbers 💡 Key Insight: Gray Code is useful in minimizing errors in digital communication, as only one bit changes at a time. Using bitwise operations makes the solution both elegant and efficient. This problem improved my understanding of bit manipulation and binary patterns. Exploring deeper into low-level concepts 🔥💪 #LeetCode #Day38 #BitManipulation #Binary #Python #ProblemSolving #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
From “it works” to “it won’t break” While writing a code, Getting it to work is one thing, 𝗠𝗮𝗸𝗶𝗻𝗴 𝘀𝘂𝗿𝗲 𝗶𝘁 𝗱𝗼𝗲𝘀𝗻’𝘁 𝗯𝗿𝗲𝗮𝗸 is another. price = products["Laptop"] This works fine… until the 𝗸𝗲𝘆 𝗱𝗼𝗲𝘀𝗻’𝘁 𝗲𝘅𝗶𝘀𝘁 . That’s when the program crashes. So instead of assuming every piece of data is present, Its better to start thinking about what happens when it isn’t. In college projects, we often focus on making things work. In real-world scenarios, 𝗲𝗱𝗴𝗲 𝗰𝗮𝘀𝗲𝘀 matter just as much. 𝗗𝗮𝘆 𝟭𝟮/𝟯𝟬 #Python #LearningInPublic #Day12 #30DaysOfCode #SoftwareEngineering
To view or add a comment, sign in
-
🚀Day-7 LeetCode Problem Solved – #3 Longest Substring Without Repeating Characters Today I solved one of the most popular Sliding Window problems on LeetCode: Longest Substring Without Repeating Characters 💡 Problem Summary: Given a string, find the length of the longest substring without any repeating characters. 🔍 Approach Used: I solved this using the Sliding Window + HashSet technique. The idea is to maintain a window of unique characters using two pointers: - left → start of the window - right → end of the window - set → stores current unique characters Whenever a duplicate character appears, I move the left pointer until the duplicate is removed, while continuously tracking the maximum length. ✨ Key Learning: This problem helped me strengthen my understanding of: - Sliding Window - Two Pointers - HashSet / Set operations - Time complexity optimization ⚡ Complexity: Time: O(n) Space: O(n) Every problem solved is one step closer to mastering DSA and problem-solving skills 💻 #LeetCode #DSA #Python #ProblemSolving #CodingJourney #SoftwareDeveloper #SlidingWindow #100DaysOfCode #InterviewPreparation
To view or add a comment, sign in
-
-
🚀 Day 39/100 – LeetCode Challenge Today’s problem: 406. Queue Reconstruction by Height This problem focuses on applying a Greedy approach with sorting to reconstruct a queue based on height and positional constraints. 🔍 Key Insight: Sort people by height in descending order and k value in ascending order, then insert each person at their respective index. 💡 What I learned: Importance of sorting strategy in greedy problems How insertion at a specific index can maintain constraints Thinking from the perspective of "who affects whom" (taller vs shorter) 🧠 Approach: Sort the array → (-height, k) Insert each person at index k 💻 Code (Python): class Solution: def reconstructQueue(self, people): people.sort(key=lambda x: (-x[0], x[1])) queue = [] for p in people: queue.insert(p[1], p) return queue ⏱️ Time Complexity: O(n²) Consistency is the key — showing up every day and improving step by step. #Day39 #LeetCode #100DaysOfCode #DSA #Python #CodingChallenge #GreedyAlgorithm #SoftwareDevelopment
To view or add a comment, sign in
-
Explore related topics
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development