Find the Duplicate Number | NeetCode 37 | LeetCode #287 Cycle detection in disguise! One of those clever problems that teach you how patterns repeat across data structures. #NeetCode #LeetCode #Java #DSA #CodingJourney
More Relevant Posts
-
NeetCode 25 | LeetCode #239 | Sliding Window Maximum Implemented an efficient solution using a deque to track potential maximums within each window. A classic example of optimizing brute force with data structures — achieving O(n) time complexity. #NeetCode #LeetCode #Java #DSA #Deque #SlidingWindow #Algorithms #ProblemSolving #CodingJourney
To view or add a comment, sign in
-
📌 Day 30/100 – Remove Duplicates from Sorted List (LeetCode 83) 🔹 Problem: Given a sorted linked list, remove all duplicate values so each number appears only once. 🔹 Approach: Traverse the list using a pointer Compare current node with next node If values match → skip the next node Else → move forward Maintain sorted order with O(1) space 🔹 Key Learning: Linked list manipulation becomes easy with pointer logic No extra space needed — entirely in-place Small logic → clean & impactful solution Edge cases matter (empty or single node list) #100DaysOfCode #Day30 #LeetCode #Java #LinkedList #DSA #CodingJourney #ProblemSolving
To view or add a comment, sign in
-
-
NeetCode 22 | LeetCode #20 | Valid Parentheses Simple yet fundamental — mastering stack operations to validate correct bracket sequences. A great reminder that clean logic and data structure fundamentals go a long way. #NeetCode #LeetCode #Java #DSA #Stack #Algorithms #ProblemSolving #CodingJourney
To view or add a comment, sign in
-
Day42/100 #leetcodegrind I successfully implemented a Stack using Queues 💪 It was an amazing problem that helped me deeply understand how data structures work internally. 📚 Key takeaways: Used Queue (FIFO) to mimic Stack (LIFO) behavior Learned how to rotate queue elements after each push Improved my understanding of time complexity and order of operations Every small step builds a strong foundation for mastering DSA 💡 #DSA #Java #CodingJourney #ProblemSolving #Stack #Queue #LeetCode #100DaysOfCode #LearningInPublic
To view or add a comment, sign in
-
-
🗓 Day 6 / 100 – #100DaysOfLeetCode 📘 Problem: 3228. Maximum Number of Operations to Move Ones to the End Difficulty: Medium 💡 Problem Summary: Given a binary string s, you can repeatedly choose an index i where s[i] == '1' and s[i+1] == '0', and move that '1' to the right until it reaches the end of the string or hits another '1'. The goal is to find the maximum number of such operations possible. 🧠 My Approach: Instead of simulating the moves (which would be inefficient), I used a counting strategy: Keep a running count of the number of '1's seen so far (cnt). Whenever a '0' appears after one or more '1's, we can perform cnt operations involving those ones. Sum these up for the final result. 📊 Complexity Analysis: Time Complexity: O(n) Space Complexity: O(1) #LeetCode #Java #ProblemSolving #CodingChallenge #100DaysOfCode #DSA #LearningEveryday
To view or add a comment, sign in
-
-
💻 Day 53 of #LeetCode100DaysChallenge Solved LeetCode 160: Intersection of Two Linked Lists — a problem that tests linked list traversal, pointer manipulation, and logical thinking. 🧩 Problem: Given the heads of two singly linked lists headA and headB, return the node where the two lists intersect. If they do not intersect, return null. 💡 Approach — Two Pointer Technique: 1️⃣ Initialize two pointers a and b at headA and headB. 2️⃣ Traverse both lists. When a pointer reaches the end of one list, redirect it to the head of the other list. 3️⃣ If the lists intersect, the pointers will meet at the intersection node. 4️⃣ If not, both pointers will eventually become null. ⚙️ Complexity: Time: O(N + M) — each list is traversed at most twice. Space: O(1) — no extra data structure used. ✨ Key Takeaways: ✅ Strengthened understanding of pointer redirection and traversal synchronization. ✅ Learned an elegant approach to detect intersection without measuring lengths. ✅ Reinforced logical thinking in linked list-based problems. #LeetCode #100DaysOfCode #Java #LinkedList #Pointers #TwoPointerTechnique #DSA #CodingJourney #WomenInTech #IntersectionOfLinkedLists
To view or add a comment, sign in
-
-
✨ Day 61 of 100: Same Tree ✨ Today’s challenge was LeetCode 100 – Same Tree 🌳 The task: Given two binary trees, determine if they are the same — meaning both structure and node values are identical. 💡 Key Takeaways: 🔹 Strengthened understanding of recursive tree traversal (checking left and right subtrees). 🔹 Practiced comparing tree nodes carefully — both value and structure. 🔹 Reinforced concepts of DFS (Depth-First Search) and base case handling in recursion. 🧠 Approach: 1️⃣ If both nodes are null, return true. 2️⃣ If only one is null, return false. 3️⃣ Check if values are equal, and then recursively verify left and right subtrees. 🌱 This problem was a great refresher on recursion fundamentals and tree comparison logic! #LeetCode #100DaysOfCode #Day61 #Java #DSA #CodingChallenge #BinaryTree #Recursion #DepthFirstSearch
To view or add a comment, sign in
-
-
Count Good Nodes in Binary Tree | NeetCode 46 | LeetCode #1448 Recursion with path tracking — compare each node with the max value so far. A clean problem that builds confidence in tree traversal logic 💡 #NeetCode #LeetCode #DSA #Java #BinaryTree #Recursion #Algorithms
To view or add a comment, sign in
-
NeetCode 14 | LeetCode #11 | Container With Most Water Solved using the two-pointer approach — expanding and shrinking boundaries to find the maximum area efficiently in O(n) time. A great example of how logical movement can outperform brute force. #NeetCode #LeetCode #Java #DSA #Algorithms #TwoPointers #ProblemSolving #CodingJourney
To view or add a comment, sign in
-
🚀 Day 51 of My #LeetCode Challenge 🧩 Problem: Remove Nodes from Linked List (LeetCode #2487) 💻 Language Used: Java 🧠 Approach Used: Reverse the Linked List – This helps us process nodes from right to left, making it easy to track the greatest value seen so far. Traverse and Remove Nodes – While traversing the reversed list, if a node’s next value is smaller than the current max, we remove that node. Otherwise, we move forward and update max. Reverse the List Again – To restore the original order (but with the smaller nodes removed). ⏱️ Time Complexity: O(n) 👉 We reverse the list twice and traverse it once — all linear operations. 💾 Space Complexity: O(1) 👉 Done completely in place without using extra data structures. 🔥 This problem strengthened my understanding of linked list reversal and in-place node deletion logic. Every day is a step closer to mastering DSA! 💪 #Day51 #LeetCode #100DaysOfCode #Java #DSA #LinkedList #ProblemSolving #CodingChallenge
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