✅ LeetCode Top 150 – Day 43 | Revision Day Today was all about reinforcing fundamentals and strengthening problem-solving intuition. I revisited 3 problems across difficulty levels and focused on patterns + intuition rather than just code. 🍬 1. Candy (Hard) Key Takeaways: Classic greedy + two-pass problem Maintain fairness by checking left → right and then right → left When values increase, give more; when values decrease, adjust backwards Intuition: Local constraints + global minimum 📌 Learning: Greedy isn't always one-directional — sometimes symmetry is the key. 💧 2. Trapping Rain Water (Hard) Key Takeaways: Key insight: Water trapped depends on min(maxLeft, maxRight) Approaches: Prefix-suffix arrays (O(n) space) Two-pointer optimal approach (O(1) space) Great example of thinking in constraints, not brute force 📌 Learning: Recognize patterns where global boundaries influence local results. 🏛️ 3. Roman to Integer (Easy) Key Takeaways: Understand subtraction rule: If current < next → subtract else add Efficient use of mapping Good revision of string traversal + conditional logic 📌 Learning: Small problems build intuition for bigger greedy patterns. #LeetCode #dsa #coding #softwareengineering #leetcode150 #learningjourney #consistencyWins
Revisiting LeetCode problems with focus on patterns and intuition
More Relevant Posts
-
🔹 Day 70 of #100DaysOfLeetCodeChallenge 🔹 🚀 Problem: Combination Sum III 🔑 Topic: Backtracking 🧠 Approach: We need to find all combinations of k distinct numbers (1–9) that sum to n. Here’s how I solved it 👇 Use backtracking to explore all combinations starting from 1 to 9. Add the number and move forward recursively, reducing both k (count) and n (target). Stop when k == 0 and n == 0 → valid combination found! Backtrack by removing the last number and continue exploring. ⏳ Time Complexity: O(2⁹) ≈ O(512) 💾 Space Complexity: O(k) (recursion + temp list) 📌 Example: Input: k = 3, n = 9 Output: [[1,2,6],[1,3,5],[2,3,4]] ✅ 🎯 Takeaway: This problem teaches the power of controlled recursion — when both depth and sum conditions guide the search efficiently. 💡 #LeetCode #DSA #Backtracking #ProblemSolving #CodingChallenge #100DaysOfLeetCodeChallenge 🚀
To view or add a comment, sign in
-
-
🚀 Day 46 of Solving DSA Problems Problem: Middle of the Linked List (LeetCode #876) 🧩 Concepts Used: Fast and slow pointer technique — also known as the Tortoise and Hare algorithm. 🧠 Approach: We use two pointers — slow moves one step at a time. fast moves two steps at a time. When fast reaches the end, slow will be at the middle node. If there are two middle nodes, the second one is returned automatically by this method. 💡 Learning Reflection: This problem beautifully demonstrates how pointer manipulation can make linked list traversal both elegant and efficient. Instead of counting nodes or using extra space, we leverage relative movement — a powerful idea in linked list problems. ⏱ Time Complexity: O(n) 📦 Space Complexity: O(1) ✨ Motivational Line: “Don’t rush the process — even slow steps can reach the middle.” #Day46 #LeetCode #DSA #LinkedList #100DaysOfCode #CodingJourney #LearnByDoing
To view or add a comment, sign in
-
-
Day 47 — #100DaysOfLeetCode 🚀 Problem: Reverse Words in a String (LeetCode 151) ✅ Approach: Trim spaces, split the string, reverse the words, and join them back. ⚡ Complexity: O(n) Learning: Improved string handling and manipulation efficiency 🔁 Every line of code adds clarity and confidence 💪 #LeetCode #100DaysOfCode #DSA #Strings #ProblemSolving #CodingJourney
To view or add a comment, sign in
-
-
🔹 Day 76 of #100DaysOfLeetCodeChallenge 🔹 🚀 Problem: Word Break 🔑 Topic: Dynamic Programming + Recursion + Memoization 🧠 Approach: We need to check if a string can be split into valid words from a given dictionary. Here’s how I solved it 👇 Used recursion + memoization to break the string into prefixes. For every prefix, if it exists in the dictionary, recursively check the rest of the string. Memoize results to avoid recomputation for overlapping substrings. Return true as soon as a valid segmentation is found. ✅ ⏳ Time Complexity: O(n³) — due to substring operations 💾 Space Complexity: O(n) — recursion + memo storage 📌 Example: Input: s = "leetcode", wordDict = ["leet","code"] Output: true ✅ Explanation: "leetcode" → "leet" + "code" 🎯 Takeaway: Combining recursion with memoization turns brute force into an efficient dynamic programming solution! ⚡ #LeetCode #DSA #DynamicProgramming #Memoization #Recursion #ProblemSolving #CodingJourney #100DaysOfLeetCodeChallenge 🚀
To view or add a comment, sign in
-
-
⚡ Day 97 of My LeetCode Journey — Problem 328: Odd Even Linked List 💡 Problem Insight: Today’s problem focused on rearranging a singly linked list so that all nodes at odd indices come first, followed by all even-indexed nodes — while maintaining their relative order. A great challenge to test how well you understand pointer manipulation! 🧠 Concept Highlight: The solution revolves around re-linking nodes using two pointers — one tracking odd nodes and another for even nodes. By carefully connecting them, we achieve the rearrangement in-place without extra space. It’s a smart exercise in linked list restructuring and pointer logic. 💪 Key Takeaway: Organizing efficiently — whether in data or in life — often means rearranging, not replacing. A small change in order can create big clarity. ✨ Daily Reflection: Linked lists truly train the mind to think sequentially and structurally — every link counts, just like every day of consistent learning. #Day97 #LeetCode #100DaysOfCode #LinkedList #ProblemSolving #DSA #CodingJourney #LearnByDoing #SoftwareEngineering #Pointers
To view or add a comment, sign in
-
-
🚀 Day 37 of #100DaysOfCode Challenge 🚀 🧠 Problem: 🧩 LeetCode 282 — Expression Add Operators (Hard) This problem was all about exploring backtracking with arithmetic logic. We’re given a string of digits and need to insert +, -, or * between them to reach a target value. ⚙️ Approach Used backtracking to: -Pick every possible substring as the next number. -Try adding each operator before it (+, -, *). -Track three things: -current value → total so far -previous operand → to handle multiplication correctly -expression → the string we’re building -Also skipped invalid paths like numbers with leading zeros. 📘 Learning -Understood how to evaluate expressions on the fly without using eval(). -Learned to manage operator precedence (* before +/-) using recursion and previous operand adjustment. -Realized that some problems can’t be optimized further — they test how well you can prune and organize recursion. #100DaysOfCode #DSA #CodingChallenge #StriversSheet #ProblemSolving #TakeUForward #Recursion #CodingInterview #ProgrammingTips #LeetCode #Backtracking
To view or add a comment, sign in
-
-
💡 Day 78 of #100DaysOfCode 💡 🔹 Problem: Find Closest Number to Zero – LeetCode ✨ Approach: Traversed through the array while keeping track of the number closest to zero using absolute difference comparison. Handled ties by preferring the positive number — because even in code, positivity wins 😉 📊 Complexity Analysis: ⏱ Time Complexity: O(n) — single pass through the array 💾 Space Complexity: O(1) — no extra space used ✅ Runtime: 3 ms (Beats 44.80%) ✅ Memory: 46.87 MB 🔑 Key Insight: Even the smallest differences matter — especially when you’re finding what’s closest to zero! ⚡ #LeetCode #100DaysOfCode #DSA #ProblemSolving #CodingChallenge #JavaProgramming #AlgorithmDesign #CodeJourney #StayPositive
To view or add a comment, sign in
-
-
KISS principle: - Writing straightforward, readable code. - Avoiding over-engineering or adding unnecessary abstractions. - Preferring simple algorithms and structures over clever but complex ones. - Designing APIs, classes, and modules that are easy to use and hard to misuse.
To view or add a comment, sign in
-
-
🌟 Day 93 of My LeetCode Journey — Problem 686: Repeated String Match 💡 Problem Insight: Today’s problem explored how many times string A must be repeated so that string B becomes a substring of it. It’s a fun mix of string repetition and pattern matching — testing both logic and edge-case awareness. 🧠 Concept Highlight: The core idea is to keep repeating A until it’s at least as long as B, then check if B exists within it (or one more repetition). This problem reinforces concepts of string concatenation, searching, and boundary conditions in text processing. 💪 Key Takeaway: Sometimes, solutions aren’t about complexity but about knowing when to stop repeating — in both coding and persistence! ✨ Daily Reflection: Simple problems like these highlight the beauty of algorithmic reasoning — transforming trial-and-error into structured logic. #Day93 #LeetCode #100DaysOfCode #StringMatching #ProblemSolving #DSA #CodingJourney #LearnByDoing #SoftwareEngineering #Persistence
To view or add a comment, sign in
-
-
🚀 LeetCode Daily Challenge – Count Operations to Obtain Zero (#2169) 🧩 Problem Statement Given two integers num1 and num2, perform operations until either of them becomes 0. In one operation, if num1 >= num2, replace num1 = num1 - num2, else num2 = num2 - num1. Return the total number of operations performed. 💡 Approach : Instead of performing subtraction repeatedly (which is inefficient), we can directly calculate how many times one number can be subtracted from the other using integer division (/) and modulo (%). This idea is similar to the Euclidean Algorithm used to find the GCD of two numbers. Steps: While both num1 and num2 are not zero: Add num1 / num2 to the count (this represents how many subtractions happen at once). Update num1 = num1 % num2. Swap num1 and num2 to continue. Return the total count. ⏱️ Time Complexity: O(log(min(num1, num2))) — Each iteration reduces one of the numbers significantly (like in GCD). 💾 Space Complexity: O(1) — Constant extra space used. #LeetCode #Coding #DSA #Learning #ProblemSolving #Consistency
To view or add a comment, sign in
-
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