Day 2 | DSA + LeetCode Practice 🚀 Continuing my #100DaysOfCode journey by focusing on problem-solving and strengthening fundamentals. ✅ Problems Solved Today: Leetcode #3 Longest Substring Without Repeating Characters 🔹 Approach: Sliding Window + Hash Set 🔹 Logic: • Used two pointers to maintain a dynamic window • Stored characters in a set to track duplicates • When a duplicate appeared, moved the left pointer and adjusted the window • Tracked the maximum window length at each step 📌 Key Learning: The sliding window technique helps optimize brute-force solutions to O(n) time complexity. Leetcode #4 Median of Two Sorted Arrays 🔹 Approach: Binary Search on the smaller array 🔹 Logic: • Applied the idea of partitioning two sorted arrays • Used binary search to find the correct partition where left-side elements are less than or equal to right-side elements • Calculated the median based on whether the combined length was even or odd 📌 Key Learning: Binary search is not just for searching—it is a powerful tool for solving optimization problems efficiently. 📌 Day 2 Takeaway: Hard problems may feel overwhelming at first, but once the core idea is clear, the solution becomes much more intuitive. Moving on to Day 3 🔁 #Day2 #100DaysOfCode #LeetCode #DSA #ProblemSolving #CPP #LearningInPublic #SoftwareEngineering 🚀
Day 2 DSA LeetCode Practice Fundamentals
More Relevant Posts
-
Day 3 | DSA + LeetCode Practice 🚀 Continuing my #100DaysOfCode challenge with a focus on understanding problem-solving patterns and thinking step by step. ✅ Problems Solved Today: Leetcode #9 🔹Palindrome Number Problem: Given an integer x, determine whether it is a palindrome. • Methodology Applied: Mathematical reasoning / Two-pointer logic • Approach: Avoided converting the number into a string Reversed half of the number mathematically Compared the reversed half with the remaining part 📌 Key Learning: Breaking the problem into smaller logical steps helps eliminate unnecessary conversions and leads to a more optimized solution. Leetcode #10 🔹 Regular Expression Matching • Methodology Applied: Dynamic Programming • Approach: Used a DP table where dp[i][j] represents whether the first i characters of string s match the first j characters of pattern p Handled two special cases carefully: → matches any single character → matches zero or more of the preceding element Built the solution bottom-up by considering all valid transitions 📌 Key Learning: Once the DP logic is clear, the solution becomes systematic. 📌 Day 3 Takeaway: Easy problems test clarity. Moving to Day 4 🔁 #Day3 #100DaysOfCode #LeetCode #DSA #ProblemSolving #CPlusPlus #BuildInPublic #DynamicProgramming #LearningInPublic 🚀
To view or add a comment, sign in
-
🌟 Day 71 of #100DaysOfCode 🌟 🔗 Count Occurrences of a Given Key in a Linked List – Simple but Powerful! 🔹 What I Solved Today’s challenge focused on traversing a singly linked list and counting how many times a specific value (key) appears. Even though it looks simple, this problem strengthens fundamentals like traversal, pointer handling, and space-optimized logic. 🧩 Problem: Count Occurrences of a Key in a Linked List 💡 Given: A singly linked list such as: 1 -> 2 -> 1 -> 2 -> 1 -> 3 -> 1 and a key, for example 1. 💥 Goal: Return the total number of times the key appears in the list. For the example above, the output is 4. 🧠 Concepts Used ➡️ Linked List Traversal Iterating through nodes one by one from head to end. ➡️ Constant Space Counting Only one integer counter is used — O(1) extra space. ➡️ Linear Time Complexity Each node is visited once — O(n). ➡️ Comparison Logic At each node, compare node.data with the key and increment the count. ⚙️ Approach 1️⃣ Start with the head of the list 2️⃣ Initialize a counter count = 0 3️⃣ Traverse each node using a loop 4️⃣ If node.data == key, increment count 5️⃣ Continue until the list reaches null 6️⃣ Return the counter 🚀 Learning This problem reinforced: ✔️ Clean linked list traversal ✔️ Handling edge cases (empty list, key not present) ✔️ Writing efficient and readable code ✔️ Understanding time & space optimization ✔️ Strengthening core DSA fundamentals #CodingLife #Programmer #LeetCode #GeeksForGeeks #JavaDeveloper #StudentCoder #LearnToCode #DeveloperCommunity #ProblemSolver #CleanCoding #LinkedList
To view or add a comment, sign in
-
-
🚀 Consistency + Fundamentals = Results Just got an Accepted solution on LeetCode ✅ 💡 0 ms runtime 💯 Beats 100% submissions This problem looks simple on the surface, but it really tests how well you understand core data structures — especially stacks and matching logic. What this reinforced for me: Strong fundamentals matter more than fancy tricks Writing clean, readable logic often leads to optimal performance Small checks (like early exits) can make a big difference Every problem solved builds confidence and clarity for the next one. One step closer to becoming a better problem solver 🚀 If you’re grinding DSA right now — keep going. Progress compounds. 💪 #LeetCode #DSA #ProblemSolving #CPlusPlus #CodingJourney #Consistency #SoftwareEngineering #LearningEveryDay
To view or add a comment, sign in
-
-
🚀 Day 31 of #100DaysOfLearning | #100DaysOfCode 🧿 Today I solved a classic and beginner-friendly problem, but with a very powerful concept behind it — Valid Parentheses (LeetCode 20). At first glance, it looks simple: Just check whether (), {}, and [] are balanced. But this problem is actually a perfect introduction to how Stack works in real scenarios. 🧩 Problem Understanding We are given a string containing only: ( ) { } [ ] The string is valid if: Every opening bracket has a matching closing bracket. Brackets are closed in the correct order. No closing bracket appears without its correct opening one. Examples: "()" → ✅ Valid "()[]{}" → ✅ Valid "(]" → ❌ Invalid "([)]" → ❌ Invalid 🛠️ Approach Using Stack I used the Stack Pattern: Traverse the string character by character. If it’s an opening bracket → push it into the stack. If it’s a closing bracket: If stack is empty → invalid. Check the top of stack: If it doesn’t match the closing bracket → invalid. Else → pop the top. At the end: If stack is empty → valid. Otherwise → invalid. This feels like real life: Every “open” action must be “closed” in the correct order. Stack naturally enforces this rule. 🧠 What I Learned Today Stack is perfect when we need to: Track previous state, Match pairs, Maintain order Even “easy” problems build the foundation for: Expression evaluation, Compiler parsing, Syntax checking Clean logic > complicated brute force. 📌 Day 31 Complete Even though the problem was easy, it strengthened my understanding of stack-based validation. Small steps like this are what build big confidence over time. 💬 “Master the basics, and the advanced problems will start feeling natural.” #Day31 #100DaysOfCode #100DaysOfLearning #Stack #DSA #LeetCode #ProblemSolving #CodingJourney #Consistency #LearnEveryDay
To view or add a comment, sign in
-
-
After solving 400+ problems on LeetCode, I realized that progress in DSA is less about memorizing solutions and more about how you think. Two things stood out as game changers for me: 🔍 1. Observation Before jumping into code, taking time to deeply observe the problem changes everything. Understanding constraints, edge cases, and hidden conditions often reveals the simplest path to the solution. 🧩 2. Pattern Recognition (Most Important) Most problems are not new — they are variations of known patterns: Sliding Window Two Pointers Binary Search on Answer DP States Greedy Choices Graph Traversals Once you recognize the pattern, half the problem is already solved. 📈 My biggest takeaway Consistency + reflection beats speed. Every wrong submission taught me why a solution works — and where it fails. Still learning. Still improving. On the journey to becoming a better problem solver every day 💻🔥 #LeetCode #DSA #ProblemSolving #Consistency #CodingJourney #SoftwareEngineering
To view or add a comment, sign in
-
-
I’ve solved 200+ questions on LeetCode, and here’s what I’ve actually learned 1️⃣ Don’t solve the whole problem at once Break the problem statement into small chunks. Understanding comes before coding. 2️⃣ Stop judging problems by tags or difficulty Don’t assume you can’t solve a “Hard” or that failing an “Easy” means you’re bad. Difficulty is subjective : it depends on whether you’ve seen the pattern before. 3️⃣ Struggle before you look at solutions Give at least 30 minutes. Even after watching the approach, try coding it yourself just by understanading the algorithm and only watch the solution if you cant solve it dont just sit and watch the solutions Passive watching = false confidence. 4️⃣ Dry run is non-negotiable It’s boring. It’s tricky. But this is where real understanding happens. Skipping it is the fastest way to think you’re learning without actually learning. 5️⃣ Revise using active recall During revision, try recalling the logic just from the problem name : without opening the statement. This forces your brain to retrieve patterns, not recognize them. DSA is less about intelligence and more about how you practice. What’s one thing LeetCode taught you the hard way ? #DataStructures #Algorithms #LeetCode #DSA #LearningInPublic #ProblemSolving #SoftwareEngineering #CodingJourney #DeveloperLife
To view or add a comment, sign in
-
-
🔥 Day 22 | Round 4 — Handling Duplicates with Backtracking! 🔥 Solved a LeetCode problem — Permutations II 💡 This problem focuses on generating all unique permutations using backtracking while carefully handling duplicate elements. By using a set at each recursion level and swapping elements in place, the solution avoids repeated permutations efficiently 💪 Great practice for mastering recursion with constraints 🚀 🔹 Concepts Used: Backtracking | Recursion | Hash Set 🔹 Key Takeaway: Pruning duplicate choices early saves a lot of unnecessary computation 🧠 #30DaysOfCode #Round4 #Day22 #LeetCode #Backtracking #Recursion #Permutations #DSA #ProblemSolving #CodingChallenge #DeveloperJourney #CodeEveryday #CPlusPlus #LearnByDoing #ConsistencyIsKey 🚀
To view or add a comment, sign in
-
-
🚀 𝑫𝒂𝒚 7 𝒐𝒇 𝑴𝒚 𝑳𝒆𝒆𝒕𝑪𝒐𝒅𝒆 𝑱𝒐𝒖𝒓𝒏𝒆𝒚 | 𝑫𝑺𝑨 – 𝑺𝒕𝒂𝒄𝒌 (𝑱𝒂𝒗𝒂) Continuing my daily DSA practice with LeetCode 📘 Today was all about using stacks to solve real-world array problems efficiently and understanding the concept of Next Smaller Element. 🔹 𝑷𝒓𝒐𝒃𝒍𝒆𝒎 𝑺𝒐𝒍𝒗𝒆𝒅 𝑻𝒐𝒅𝒂𝒚: 𝑭𝒊𝒏𝒂𝒍 𝑷𝒓𝒊𝒄𝒆𝒔 𝑾𝒊𝒕𝒉 𝒂 𝑺𝒑𝒆𝒄𝒊𝒂𝒍 𝑫𝒊𝒔𝒄𝒐𝒖𝒏𝒕 𝒊𝒏 𝒂 𝑺𝒉𝒐𝒑 (https://lnkd.in/gNZSzHNQ) 🔹 Key Concept Used: Monotonic Stack (Next Smaller or Equal Element to the Right) 🔹 𝐂𝐨𝐦𝐩𝐥𝐞𝐱𝐢𝐭𝐲 𝐀𝐧𝐚𝐥𝐲𝐬𝐢𝐬: Time Complexity: O(n) Space Complexity: O(n) 🔹 What I’m Learning: • Stack helps avoid unnecessary nested loops • Index-based stack usage simplifies discount calculation • Recognizing patterns like “next smaller element” is crucial • Clean logic + practice = faster problem solving Solving one problem a day and strengthening fundamentals step by step. Consistency over intensity.🚀 #LeetCode #DSA #Stacks #Java #ProblemSolving #DailyCoding #Consistency #LearningJourney #BackendDeveloper #2026Goals
To view or add a comment, sign in
-
-
𝗙𝗶𝗿𝘀𝘁 𝗣𝗼𝘀𝘁! 🚀 𝟯/𝟰 𝗦𝗼𝗹𝘃𝗲𝗱 𝗶𝗻 𝗪𝗲𝗲𝗸𝗹𝘆 𝗖𝗼𝗻𝘁𝗲𝘀𝘁 𝟰𝟴𝟲 (𝗥𝗮𝗻𝗸 𝟰𝟮𝟴𝟭) I’ve been a bit shy about documenting my journey publicly, but I decided it’s time to step out of my comfort zone and celebrate the small wins. I had a solid run in today’s LeetCode contest. I actually solved the problems in 40 mins, but a 5-minute penalty on Q2 (due to a Runtime Error) pushed my official time to 45 minutes. Here is a quick breakdown of my approach: 𝗤𝟭: 𝗠𝗶𝗻𝗶𝗺𝘂𝗺 𝗣𝗿𝗲𝗳𝗶𝘅 𝗥𝗲𝗺𝗼𝘃𝗮𝗹 Used a Reverse Greedy strategy. Scanning from n-1 down to 0 allows you to instantly find the first index where the strictly increasing order breaks. O(N) time, no extra space. 𝗤𝟮: 𝗥𝗼𝘁𝗮𝘁𝗲 𝗡𝗼𝗻-𝗡𝗲𝗴𝗮𝘁𝗶𝘃𝗲 𝗘𝗹𝗲𝗺𝗲𝗻𝘁𝘀 I extracted the non-negative numbers into a vector b. To rotate it without extra space, I used a manual sequence: calculated p = k % b.size(), pushed the first p elements to the back, reversed the vector, popped the excess, and reversed it back. Finally, I replaced the original non-negative elements in the main array with these new values. The Mistake: I missed the check for b.size() == 0 before calculating the modulo, which caused a Division by Zero crash. 𝗤𝟯: 𝗣𝘆𝘁𝗵𝗮𝗴𝗼𝗿𝗲𝗮𝗻 𝗗𝗶𝘀𝘁𝗮𝗻𝗰𝗲 𝗡𝗼𝗱𝗲𝘀 Standard Multi-Source DFS. I ran the traversal three times to get distances from X, Y, and Z. For each node, I collected the three distances, sorted them to find the hypotenuse, and then checked the theorem (a² + b² = c²). Feels good to finally break the ice on LinkedIn. Let’s see how the consistency goes. Happy Coding! 💻 #LeetCode #TLEEliminators #DSA #CompetitiveProgramming #CPP #Algorithms #SDE #FirstPost #ProblemSolving
To view or add a comment, sign in
-
-
LeetCode Problem of the Day — Back to Fundamentals Today’s POTD (LeetCode 3315: Construct the Minimum Bitwise Array II) serves as a valuable reminder that some of the most essential problem-solving skills in software engineering remain unchanged over the years. The task is straightforward: ans[i] | (ans[i] + 1) == nums[i] Minimize ans[i]. However, the real challenge lies in reasoning rather than coding. Here are a few insights that made a difference: - Even numbers are impossible: No matter what value you choose, x | (x + 1) is always odd. This observation resolves half the cases immediately. - Binary structure > brute force: Incrementing a number flips trailing bits. To achieve the minimum valid answer, you modify exactly one bit: the bit just before the first zero. - An O(1) solution emerges naturally: Once the pattern is clear, the solution simplifies to a single, clean bitwise operation. Why I appreciate problems like this is that they reward: - Understanding over memorization - Precision over trial-and-error - Fundamentals over frameworks These skills are crucial in real systems — performance tuning, debugging, and designing reliable software. Strong fundamentals compound over time. Problems like today’s POTD remind us to keep these skills sharp. On to the next one. Let's Connect : Harshit goel #LeetCode #ProblemOfTheDay #BitManipulation #DataStructures #Algorithms #ProblemSolving #SoftwareEngineering #CodingInterview #ComputerScience #LearningEveryDay
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