🚀 DSA Day 18: Shifting Pointers & Linking Logic! 🔗🧠 Today was less about the theory and more about the logic. Implementing get, insert, and delete really forced me to see the code as a physical chain. The big "Aha!" moment: Realizing the power of O(1) insertions. In an array, adding to the front is a chore; here, you just move the head pointer and you’re done. ⚡️ It’s definitely a game of precision, though. If you don't handle the pointers in the right order—like making the "handshake" before breaking the old link—you lose your entire list to the void. 🕳️ Feeling way more confident with pointer logic now. On to Day 19! ➡️ #Day18 #JavaScript #DSA #LinkedList #CodingJourney #DataStructures #LearningInPublic #WebDev #LogicBuilding
Shifting Pointers & O(1) Insertions in Linked Lists
More Relevant Posts
-
🚀 Day 10/100 – #100DaysOfDSA Double digits! 🎯 Today was all about mastering Linked List traversal and pointer manipulation. 🔹 Problems Solved: 1. Middle of the Linked List 2. Reverse Linked List 💡 Key Learnings: 👉 Problem 1: Middle of the Linked List Used Two Pointer Technique (Slow & Fast pointers) Slow moves 1 step, Fast moves 2 steps When fast reaches end → slow is at the middle ✅ O(n) Time ✅ O(1) Space ✅ Efficient single-pass solution 👉 Problem 2: Reverse Linked List Iterative approach using three pointers: prev, current, next Reverse links one by one 👉 Core Idea: Change direction of next pointer at each step ✅ O(n) Time ✅ O(1) Space 🔥 What I learned today: Linked Lists are all about pointer control — once you master that, many problems become easier. The slow & fast pointer technique is 🔥 — super useful pattern! Day 10 done ✅ Staying consistent 💪 #100DaysOfCode #DSA #LinkedList #ProblemSolving #CodingJourney #JavaScript #TechGrowth #SoftwareEngineer #LearningInPublic #Developers
To view or add a comment, sign in
-
Still consistent with my DSA practice — focusing on core logic building. 🚀 Today I worked on: 🔹 Find Intersection of Two Arrays Problem: Given two arrays, find the common elements between them. Simple brute-force approach, but it clearly shows how nested loops and comparisons work. Yeah, this isn’t optimized — but right now I’m focusing on understanding logic first, optimization later. Because if your base is weak, no “optimized solution” will save you. #DSA #JavaScript #ProblemSolving #CodingJourney #Consistency
To view or add a comment, sign in
-
-
For years, finding the last matching element or its index in a JavaScript array meant writing clumsy loops or reversing arrays. This not only added unnecessary lines of code but also obscured the intent, making your code harder to read and maintain. Many developers still resort to these manual iterations because they're familiar patterns or they're simply unaware of the newer, more direct Array methods. Using verbose loops for a common task like finding the last occurrence can introduce subtle bugs, especially when managing loop conditions and break statements. The lack of a native `findLast()` or `findLastIndex()` method led to developers crafting custom solutions that varied in performance and reliability across codebases. This inconsistency made onboarding new team members tougher and slowed down code reviews. It also forced developers to write more complex conditional logic to handle edge cases like empty arrays or no matches. With `Array.findLast()` and `Array.findLastIndex()`, introduced in ES2023, you can achieve this with a single, expressive line of code. These methods are concise, performant, and make your code's purpose immediately clear. Are you still using reverse loops or `reduceRight()` to find the last matching item? #JavaScript #ES2023 #WebDevelopment #CodeCleanUp #JSArrayMethods
To view or add a comment, sign in
-
-
🚀 Day 13/100 – #100DaysOfDSA Today was all about efficient deletion in Linked Lists and handling edge cases in a single pass 🔗 🔹 Problems Solved: 1. Remove Nth Node From End of List 2. Remove Duplicates from Sorted List 💡 Key Learnings: 👉 Problem 1: Remove Nth Node From End Used Two Pointer Technique (Fast & Slow) Move fast pointer n steps ahead Then move both pointers until fast reaches the end Slow will be just before the node to delete 👉 Key Trick: Use a dummy node to handle edge cases (like removing head) ✅ One-pass solution ✅ O(n) Time ✅ O(1) Space 👉 Problem 2: Remove Duplicates from Sorted List Since list is sorted → duplicates are adjacent Traverse and compare current node with next Skip duplicate nodes ✅ O(n) Time ✅ O(1) Space 🔥 What I learned today: Using dummy nodes + two pointers makes Linked List problems much cleaner and avoids edge-case bugs. Patterns are repeating, confidence is growing 📈 Day 13 done ✅ Let’s keep pushing 💪 #100DaysOfCode #DSA #LinkedList #ProblemSolving #CodingJourney #JavaScript #TechGrowth #SoftwareEngineer #LearningInPublic #Developers
To view or add a comment, sign in
-
Most engineers draw system diagrams. I built them alive. 🔥 Load Balancers. Caching layers. CAP Theorem. Message Queues — concepts that took me weeks to grasp from textbooks, now rendered as live, animated flows you can actually watch in your browser. Just pure HTML, CSS, and JavaScript proving you don't need heavy dependencies to build something beautiful and blazing fast. 11 FAANG-level concepts. Zero jargon. One visual atlas. If you're a developer who learns by seeing, this was built for you #SystemDesign #SoftwareEngineering #WebDevelopment #LearningInPublic #JavaScript #BackendDevelopment #TechEducation #OpenSource #100DaysOfCode #CareerInTech
To view or add a comment, sign in
-
Day 4/75 Blind 75 - Weekend Revision Session! Missed posting yesterday, but didn't miss grinding 💪 Revisited Days 1-3 Arrays patterns: text 1️⃣ Two Sum (#1) → HashMap: target - nums[i] lookup = O(n) 2️⃣ Buy/Sell Stock (#121) → Min tracking: buy low → sell high = O(n) 3️⃣ Contains Duplicate (#217) → HashMap: seen[num] exists = O(n) Key patterns locked: HashMap: Complements, duplicates, frequency Min tracking: Running minimum for profit/max Arrays: Always think O(n) before O(n²) HashMap template (reused 2/3 problems): javascript const seen = {}; for(let i = 0; i < nums.length; i++) { if(seen[nums[i]] !== undefined) return true; seen[nums[i]] = i; // or true } Progress: 3/75 solved + 1/1 revised Next: Group Anagrams tomorrow! Consistency > perfection - back on track! 🚀 #DSA #LeetCode #Blind75 #JavaScript #Frontend #HyderabadTech
To view or add a comment, sign in
-
Day 82 of #100DaysOfCode Today I learned Hashing and Frequency Maps, a powerful concept in DSA. Covered: • Counting elements efficiently • Solving problems using key-value pairs • Optimizing time complexity #DSA #JavaScript #CodingInterview #LearningInPublic
To view or add a comment, sign in
-
I used var, let, and const without really thinking about it. I just followed the usual advice, use const, avoid var, use let when something changes. Recently I actually took the time to understand why. It’s really about control. var doesn’t respect block boundaries, which can lead to unexpected behavior. let and const stay within the block they’re defined in, which makes things more predictable. And then const prevents reassignment, while let allows it. Nothing changed about the syntax. Just the understanding. #javascript #webdevelopment #coding #softwareengineering
To view or add a comment, sign in
-
Unique Permutations using Backtracking Day 9👈 At first glance, permutations are straightforward — but handling duplicates efficiently is where the real challenge lies. Key idea: -- Sort the array first -- Skip duplicate elements during iteration to avoid redundant permutations -- Use backtracking to explore all possible combinations. #JavaScript #TypeScript #DSA #Algorithms #Backtracking #CodingInterview #FrontendDeveloper #LearnToCode #ProblemSolving #100DaysOfCode
To view or add a comment, sign in
-
-
🚀 DSA Challenge – Multiple Pointers Pattern 💡 Problem Given a sorted array and a target average, determine if there exists a pair whose average equals the target. 🔍 Examples averagePair([1,2,3], 2.5) ➝ true averagePair([1,3,3,5,6,7,10,12,19], 8) ➝ true averagePair([], 4) ➝ false ⚡ Approach • Initialize two pointers → one at the start, one at the end • Calculate the average of the two values • Move pointers based on comparison with the target • Achieve O(N) time and O(1) space complexity 🧠 Key Learning Instead of checking all possible pairs (O(N²)), leveraging the sorted nature of the array with the two-pointer technique makes the solution highly efficient. 🔥 Consistency is key — showing up daily to improve problem-solving skills and build stronger fundamentals. 👉 How would you approach this problem? Any edge cases or optimizations you’d consider? 🔗 GitHub: https://lnkd.in/gurx_UXW #DSA #JavaScript #CodingChallenge #100DaysOfCode #ProblemSolving #FrontendDeveloper #FullStackDeveloper #LearningInPublic #TechJourney
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