🚀 Day 2/100 – #100DaysOfDSA Continuing the journey with two interesting problems today! 🔹 Problems Solved: Best Time to Buy and Sell Stock Reverse String 💡 Key Learnings: 👉 Problem 1: Best Time to Buy & Sell Stock Used a greedy + two pointer mindset Track the minimum price so far (buy) and calculate profit at each step Update max profit whenever a better opportunity appears ✅ O(n) Time ✅ O(1) Space 👉 Problem 2: Reverse String Classic Two Pointer Technique One pointer at start, one at end Swap characters and move inward ✅ In-place solution ✅ No extra memory used 🔥 What I learned today: Sometimes the best solutions are not complex — just about tracking the right values at the right time. Consistency > Perfection. See you on Day 3 💪 #100DaysOfCode #DSA #LeetCode #ProblemSolving #CodingJourney #JavaScript #Developers #TechGrowth #SoftwareEngineer #LearningInPublic
Day 2 of 100 Days of DSA: Stock and String Problems
More Relevant Posts
-
🚀 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
-
🚀 Day 5/100 – #100DaysOfDSA Today’s focus was on recursion and understanding how problems break down into smaller subproblems. 🔹 Problems Solved: 1. Power of Two 2. Fibonacci Number 💡 Key Learnings: 👉 Problem 1: Power of Two (Using Recursion) Base Case: n === 1 → true If n is divisible by 2, recursively check n / 2 If not divisible → false ✅ Clean recursive breakdown ✅ Helps understand divide-by-2 pattern 👉 Problem 2: Fibonacci Number (Using Recursion) Base Cases: F(0) = 0, F(1) = 1 Recursive Relation: F(n) = F(n-1) + F(n-2) ✅ Learned that: Simple recursion is intuitive 🔥 What I learned today: Recursion is powerful for understanding problem structure. Building consistency, one step at a time 💪 #100DaysOfCode #DSA #Recursion #LeetCode #ProblemSolving #CodingJourney #JavaScript #TechGrowth #SoftwareEngineer #LearningInPublic
To view or add a comment, sign in
-
🚀 Day 12/100 – #100DaysOfDSA Today was all about handling edge cases and smart traversal in Linked Lists 🔗 🔹 Problems Solved: 1. Intersection of Two Linked Lists 2. Remove Linked List Elements 💡 Key Learnings: 👉 Problem 1: Intersection of Two Linked Lists Used a HashSet approach Store nodes of one list and check in the other ✅ O(n + m) Time ❌ O(n) Space 💡 Optimization Insight: Can be solved using Two Pointer Technique with O(1) space Traverse both lists → switch heads → they meet at intersection 👉 Problem 2: Remove Linked List Elements Traverse the list and remove nodes matching given value Use a dummy node to handle edge cases (like removing head) 👉 Key Idea: Always keep track of previous node while deleting ✅ O(n) Time ✅ O(1) Space 🔥 What I learned today: Handling edge cases (like deleting head nodes or null cases) is just as important as solving the problem itself. Also learned that there’s always a more optimal solution worth exploring 👀 Day 12 done ✅ Let’s keep going strong 💪 #100DaysOfCode #DSA #LinkedList #ProblemSolving #CodingJourney #JavaScript #TechGrowth #SoftwareEngineer #LearningInPublic #Developers
To view or add a comment, sign in
-
Day 112 of #200DaysOfCode Leveling up Consistency continues, one concept at a time. Today I solved the "Memoize" problem on LeetCode using closures + caching in JavaScript. Key Idea: Avoid recomputing the same function call by storing previously calculated results. Approach: • Use a Map as cache storage • Convert arguments into a unique key using JSON.stringify() • If result already exists return cached value • Otherwise compute, store, and return result Concepts Used: • Closures • Memoization • Map • Higher Order Functions Time Complexity: • First Call → Depends on function • Repeated Calls → O(1) average lookup Space Complexity: O(n) Takeaway: Memoization is a powerful optimization technique that trades space for speed and is heavily used in Dynamic Programming and performance optimization. Learning not just to solve problems — but to make solutions smarter Let’s keep building #Day112 #200DaysOfCode #LeetCode #JavaScript #Memoization #Closures #CodingJourney #ProblemSolving #KeepGoing
To view or add a comment, sign in
-
-
🚀 Day 23 of #60DaysOfDSA Today I implemented Quick Sort, a powerful Divide & Conquer algorithm used for sorting. 🔍 What I learned: Quick Sort works by selecting a pivot element It partitions the array into: Elements smaller than pivot Elements greater than pivot Then recursively sorts both parts ⚡ Key Insight: “Partitioning is the heart of Quick Sort.” Even a small mistake in index handling or swapping can completely break the logic. 💻 Key Concepts Covered: ✔️ Pivot selection (last element) ✔️ Partition logic (Lomuto method) ✔️ Recursion ✔️ In-place sorting 🧠 Takeaway: Quick Sort is not just about writing code, it’s about understanding how elements move and how recursion divides the problem. Consistency > Perfection 🚀 One step closer to becoming better every day! #DSA #QuickSort #CodingJourney #JavaScript #ProblemSolving
To view or add a comment, sign in
-
-
🚀 Day 6/100 – #100DaysOfDSA Today’s focus was on searching vs sorting and understanding efficiency differences. 🔹 Problems Solved: 1. Binary Search 2. Bubble Sort 💡 Key Learnings: 👉 Problem 1: Binary Search Works only on sorted arrays Divide the search space into half each time 👉 Approach: Find mid index Compare with target Move left or right accordingly ✅ O(log n) Time Complexity ✅ Very efficient for large datasets 👉 Problem 2: Bubble Sort Most people implement Bubble Sort, but today I learned how to optimize it using an early break condition 🚀 👉 Approach: If no swaps happen in a pass, the array is already sorted — so we can stop early instead of continuing unnecessary iterations. ✅O(n) (Optimized with swap flag) 🔥 What I learned today: Choosing the right algorithm matters more than just solving the problem. Consistency continues 💪 Day 6 done! #100DaysOfCode #DSA #BinarySearch #Sorting #LeetCode #ProblemSolving #CodingJourney #JavaScript #TechGrowth #SoftwareEngineer #LearningInPublic
To view or add a comment, sign in
-
🚀 Day 25 of #DevDSA Today’s problem: 👉 Find the element that appears only once in an array 💡 Approach I used : Created an object to store frequency of elements Traversed the array and counted occurrences Iterated over the object to find the element with frequency = 1 🧠 Key Learning: In JavaScript, an object works like a HashMap and is very useful for: Frequency counting Tracking occurrences Solving “unique element” problems efficiently ⏱ Complexity: Time → O(n) Space → O(n) 🔍 Example: Input → [1,2,2,3,3] Output → 1 Consistency > perfection 💯 Day by day, getting better. #Day25 #DSA #JavaScript #ProblemSolving #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
🌞 Back to LeetCode 75 – Day 43 ✅ 841. Keys and Rooms After a short break, I’m getting back into my daily problem-solving routine. Today’s problem was about checking whether we can visit all rooms starting from room 0, where each room contains keys to other rooms. Approach : This is basically a graph traversal problem in disguise. - Each room = a node - Keys = edges to other nodes So the task becomes: - Can we reach all nodes starting from node 0? I used an iterative DFS with a stack: - Start from room 0 - Use a visited array to track visited rooms - Keep exploring using available keys - Push unvisited connected rooms into the stack Complexity : - Time: O(N + K) - Space: O(N) Key Takeaway : Once you recognize this as a graph problem, the solution becomes straightforward. This is a good reminder that many array-like problems are actually graph problems in disguise. Restarting the consistency journey again — one problem at a time. 🚀 #LeetCode75 #Day43 #DSA #JavaScript #Graph #DFS #ProblemSolving #Coding #LearningInPublic #Consistency
To view or add a comment, sign in
-
-
Completed Episode 8 "Deep dive into v8 engine" of Namaste Node.js season -1 #NamasteNodejs by Akshay Saini 🚀 learned how v8 engine takes your code through parsing, interpretation and jit compilation to turn it into fast ,optimized machine code.. 🧠 Parsing Stage Lexical Analysis + Tokenization Breaks code into small units called tokens (keywords, variables, operators). Example: var a = 10; → converted into tokens for easier processing. Syntax Analysis + AST Tokens are converted into an Abstract Syntax Tree (AST). AST represents the structure and logic of the code. Invalid syntax prevents AST creation, resulting in a syntax error. ⚙️ JavaScript Nature Interpreted + Compiled JavaScript is neither purely interpreted nor compiled. It combines both approaches to balance fast execution and performance. 🚀 Execution Pipeline Ignition Converts AST into bytecode and executes it initially. Bytecode An intermediate representation that is more efficient than raw JavaScript. TurboFan Optimizes frequently executed code and converts it into machine code for high performance. 🔥 Optimization makes your code run faster by turning commonly used code into highly efficient machine level instruction. Deoptimization If optimization assumptions fail (e.g., changing data types), the code falls back to the interpreter. #JavaScript #V8Engine #NodeJS #WebDevelopment #Frontend #Backend #FullStack #JSInternals #Coding #Programming #Developers #LearnToCode #Tech #SoftwareEngineering #JIT #TurboFan #Ignition #AST #Parsing #Execution #JSConcepts #CodingJourney #DeveloperLife #PerformanceOptimization #CodeLife #100DaysOfCode #DevCommunity #SoftwareDeveloper #TechLearning
To view or add a comment, sign in
-
-
Day 20. Here's what got done: ✅DSA — Tackled LeetCode #707 — Design Linked List, going hands-on with one of the most fundamental data structures. Also revisited Binary Search to keep the foundations sharp. ✅React — Shipped Challenge 5 of the daily React series — a Rock, Paper, Scissors game. Clean logic, real interactivity, done. ✅Operating Systems — Learned the 4 conditions that must hold for a deadlock to occur — and why removing even one breaks the whole thing. Also dug into Mutex vs Semaphore: what each is, when to reach for one over the other. Deadlocks, data structures, and dice rolls — not a bad Tuesday. See you at Day 21. 🚀 #DSA #100DaysOfCode #BuildInPublic #LeetCode #ReactJS #OperatingSystems #WebDev #DevJourney
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