Day 40 – Staying Consistent 🚀 🧠 DSA – (Linked List): Reverse Linked List Detect Cycle ⚛️ Development: Pagination API Filtering + Sorting Backend 💻 Machine Coding: Data Table with Pagination + Sorting Now building interview-level features. #50DaysOfCode
Day 40: Linked List Development and Interview Prep
More Relevant Posts
-
🚀 Binary Search | Clean Thinking > Complex Code Just solved the classic Binary Search LeetCode Problem 704 with 100% test cases passing and optimal runtime. Here’s a structured breakdown of my approach 👇 🎯 Problem Goal Find the index of a target element in a sorted array using an efficient approach. 🧠 My Approach 1. Define the Search Space → Initialize low = 0, high = n - 1 2. Apply Binary Search Logic → Compute mid → Compare target with nums[mid] → Eliminate half of the search space each step 3. Maintain Clean Boundaries → Move low or high precisely to avoid infinite loops 4. Exit Condition → Return index if found → Else return -1 ⚡ What I Focused On • Writing minimal, readable code • Avoiding unnecessary conditions • Staying calm and methodical • Trusting fundamentals over shortcuts 💡 Key Takeaway Strong fundamentals + structured thinking = fast and reliable problem solving 📈 Outcome ✔️ 100% test cases passed ✔️ Optimal time complexity: O(log n) ✔️ Clean execution without overthinking Building this discipline every day. Small wins → Big growth 💪 #BinarySearch #DataStructures #ProblemSolving #LeetCode #CodingJourney #TechGrowth #Consistency #LearningInPublic
To view or add a comment, sign in
-
-
🚀 Day 15 of My DSA Journey | Top K Frequent Elements 🔥 Today, I solved one of the most important and frequently asked problems on LeetCode — Top K Frequent Elements. 💡 Problem Understanding Given an integer array, we need to return the k most frequent elements. Sounds simple, but the challenge is to do it efficiently ⚡ 🧠 Brute Force Approach Count frequency using loops Sort elements based on frequency Pick top k ⛔ Time Complexity: O(n² log n) (inefficient for large inputs) ⚡ Optimized Approach (HashMap + Sorting) Here’s what I did: ✅ Step 1: Use a HashMap to store frequency of each element ✅ Step 2: Convert map into array of (frequency, element) pairs ✅ Step 3: Sort array in descending order of frequency ✅ Step 4: Pick first k elements 📌 Example Walkthrough Input: nums = [1,1,1,2,2,3], k = 2 Frequency Map: 1 → 3 times 2 → 2 times 3 → 1 time Sorted: (3,1), (2,2), (1,3) Output: [1,2] ⏱ Complexity Analysis Time: O(n log n) (due to sorting) Space: O(n) 🔥 Key Learning HashMap is super powerful for frequency problems Converting data into sortable structure simplifies logic Always think: Can I reduce nested loops? 🙏 Thanks to my mentor and consistency mindset — improving every single day 💪Day by day, problem by problem — becoming better than yesterday 🚀 #Day15 #DSAJourney #LeetCode #Java #Coding #ProblemSolving #HashMap #Sorting #TopKFrequent #Consistency #LearningInPublic
To view or add a comment, sign in
-
-
🚀 Cracked one of the toughest 🔥 problems on LeetCode — Median of Two Sorted Arrays." 💡 Problem: Find the median of two sorted arrays in O(log (m+n)) time. 🧠 Key Insight: Instead of merging arrays (O(n)), I used Binary Search + Partitioning to split both arrays such that: ✔ Left half contains equal elements ✔ All left elements ≤ right elements ⚙️ Approach Highlights: ✅ Binary search on smaller array ✅ Handle edge cases using ±∞ ✅ Partition validation logic ✅ Works for both even & odd lengths 🔥 Journey: After 3 attempts, finally nailed this problem 💪 Each attempt taught something new — edge cases, partition logic, and precision. ⚡ Result: ✔ Accepted ✅ ⚡ Runtime: 0 ms (Beats 100%) 💻 Clean & optimal solution 🎯 What I learned: Thinking beyond brute force is key Binary search isn’t just for searching Edge cases define correctness 💬 Challenge for you: Can you solve this without merging arrays? 😉 #LeetCode #DataStructures #Algorithms #BinarySearch #CodingInterview #SoftwareEngineer #ProblemSolving #TechInterview #100DaysOfCode
To view or add a comment, sign in
-
-
Day 97/100 – #100DaysOfLeetCode 🚀 🧩 Problem: LeetCode 456 – 132 Pattern(Medium) 🧠 Approach: Traverse the array from right to left while maintaining a stack. Use a variable to track the “middle” element (the ‘2’ in 132 pattern) and check if a valid pattern exists. 💻 Solution: class Solution: def find132pattern(self, nums: List[int]) -> bool: stack = [] third = float('-inf') for i in range(len(nums) - 1, -1, -1): if nums[i] < third: return True while stack and nums[i] > stack[-1]: third = stack.pop() stack.append(nums[i]) return False ⏱ Time | Space: O(n) | O(n) 📌 Key Takeaway: Using a monotonic stack while iterating backwards helps efficiently detect complex patterns in linear time. #leetcode #dsa #development #problemSolving #CodingChallenge
To view or add a comment, sign in
-
-
Day 12/100 – Building Consistency in DSA Solved “Sqrt(x)” (LeetCode #69) today using a Binary Search approach. The challenge was to compute the square root of a non-negative integer without using built-in functions, while ensuring the result is rounded down. What stood out: This problem highlights how Binary Search can be applied beyond sorted arrays—specifically in narrowing down an answer space efficiently. Key Insights: Reduced time complexity from O(n) to O(log n) Strengthened understanding of boundary conditions and edge cases Practiced writing precise and overflow-safe logic Takeaway: Problems labeled “Easy” often carry fundamental patterns that are crucial for solving harder problems. Consistency > Intensity. Showing up every day. #Day12 #100DaysOfCode #DSA #LeetCode #BinarySearch #ProblemSolving #SoftwareEngineering
To view or add a comment, sign in
-
-
🚀 Day 4 — Reverse Integer Continuing my journey of improving problem-solving skills with consistency and discipline — one problem every day. Today’s challenge was not just about reversing digits, but handling constraints smartly. 🧩 Problem Solved: • Reverse Integer (LeetCode #7) 📚 Topic: Math + Edge Case Handling 💡 Key Insight: Reversing a number is easy — but ensuring the result stays within the 32-bit integer range is the real challenge. ⚡ Approach: • Identify the sign of the number • Convert number to absolute value • Extract digits using % 10 • Build reversed number step by step • Check for overflow before updating • Reapply the original sign 🎯 Takeaway: Writing code that works is good — writing code that handles edge cases is better. ⏱ Complexity: • Time → O(log n) • Space → O(1) 💻 Example: Input → 123 → Output → 321 Input → -123 → Output → -321 Input → 120 → Output → 21 Consistency builds confidence 🚀 #ProblemSolving #LeetCode #CodingJourney #100DaysOfCode #Consistency #LearningInPublic
To view or add a comment, sign in
-
-
Day 13 of My LinkedIn Challenge Today I worked on an interesting problem: Largest Number (LeetCode - Medium) The goal was to arrange numbers such that they form the largest possible number — sounds simple, but the trick is in the custom sorting logic What I learned today: - How to use custom comparators in sorting - Why comparing "a+b" and "b+a" is important - Thinking beyond normal numerical sorting Key insight: Sorting numbers normally doesn’t work here — we need to treat them as strings and decide order based on which combination gives a bigger result. Takeaway: Sometimes the problem is not about complex algorithms, but about thinking in a different way. Consistency is slowly turning confusion into clarity #Day13 #LinkedInChallenge #DSA #LeetCode #Sorting #ProblemSolving #CodingJourney
To view or add a comment, sign in
-
-
🚀 Day 116 of My DSA Problem Solving Journey - The Grind Continues! 🎉 After mastering queue implementations yesterday, today I leveled up by diving into the world of Monotonic Stacks! I tackled a classic LeetCode Medium problem: "Daily Temperatures" in C++. The Problem: Given an array representing daily temperatures, we need to figure out exactly how many days we have to wait after each day to get a warmer temperature. If there's no warmer day in the future, we just return 0. My Approach: At first glance, you might think of using a nested loop to check every future day, but that would give us a slow O(N²) time complexity. How do we do this efficiently in a single pass? The answer: A Monotonic Decreasing Stack! 🧠 The Logic: Storing Indices: Instead of storing the actual temperatures in the stack, I stored their indices. This is the golden trick because we need the index to calculate the number of days we waited! Iterating & Comparing: As I iterate through the array, I constantly check if the current day's temperature is greater than the temperature of the day sitting at the top of the stack. Pop & Calculate: If it is warmer, bingo! We found a warmer day for that past element. I pop that previous day's index from the stack, calculate the difference in days (current_index - previous_index), and store that difference in my answer array. I keep popping as long as the current day is warmer than the stack's top. Push: Once all cooler past days are resolved, I push the current day's index onto the stack so it can wait for its own future warmer day. Takeaway: This problem is a textbook lesson in optimizing time complexity. Even though there's a while loop inside a for loop, every index is pushed onto the stack exactly once and popped at most once. This brings our overall Time Complexity down to a beautiful O(N)! A brilliant way to keep track of elements that are "waiting" for a specific condition. ⚡ Keep pushing! 💻🔥 #Day116 #CPP #Stack #MonotonicStack #LeetCode #DataStructures #Algorithms #DSA #ProblemSolving #CodingJourney #ContinuousLearning #REGexSoftwareServices REGex Software Services LeetCode
To view or add a comment, sign in
-
-
🚀 Day 85 – DSA Journey | Balanced Binary Tree Continuing my daily DSA practice, today I tackled a problem that combines tree traversal with optimization. 📌 Problem Practiced: Balanced Binary Tree (LeetCode 110) 🔍 Problem Idea: Determine whether a binary tree is height-balanced — meaning the difference between heights of left and right subtrees is at most 1 for every node. 💡 Key Insight: Instead of calculating height separately for each node (which leads to O(n²)), we can compute height and check balance in a single traversal using a smart approach. 📌 Approach Used: • Use recursion to calculate height of each subtree • If any subtree is unbalanced, return -1 immediately • Check if |left height - right height| > 1 → not balanced • Otherwise, return height = 1 + max(left, right) • Final result depends on whether we ever get -1 📌 Concepts Strengthened: • Tree traversal • Recursion optimization • Early stopping technique • Efficient problem solving ⏱️ Time Complexity: O(n) 📦 Space Complexity: O(h) (recursion stack) 🔥 Today’s takeaway: Optimizing recursive solutions by combining multiple checks into one traversal can significantly improve performance. On to Day 86! 🚀 #Day85 #DSAJourney #LeetCode #BinaryTree #Recursion #Java #ProblemSolving #Coding #LearningInPublic #Consistency
To view or add a comment, sign in
-
-
🚀 Day 97 of 100 Days of DSA 📌 LeetCode #96 (Unique Binary Search Trees) 📈 "Consistency over motivation, Progress over perfection" A classic Dynamic Programming problem that introduces the concept of Catalan Numbers. 🧩 Problem Statement Given an integer n: Count the number of structurally unique BSTs that can be formed using values from 1 to n 🧠 Thought Process At first: Try constructing all possible BSTs But quickly: - Number of trees grows rapidly - Explicit construction becomes inefficient So the focus shifts to: Counting instead of constructing 🚫 Brute Force Approach 1. Try all possible ways to build BSTs 2. For each root: • Recursively build left and right subtrees Problems: • Repeated subproblems • Huge recursion tree Time Complexity → Exponential ❌ 🔍 Key Insight Pick any number i as root: Left subtree → values [1 … i-1] Right subtree → values [i+1 … n] Number of BSTs: left_subtrees × right_subtrees 💡 Recurrence Relation Let: dp[n] = number of unique BSTs with n nodes Then: For each root i: dp[n] += dp[i - 1] * dp[n - i] ✅ Approach Used Dynamic Programming (Catalan Pattern) ⚙️ Strategy 1. Base cases: • dp[0] = 1 (empty tree) • dp[1] = 1 2. For each number of nodes: • Try every possible root • Combine left & right subtree counts 3. Build solution bottom-up 💡 Intuition Instead of building trees: Count how many ways left and right can be formed Then combine them. This transforms a structural problem into a counting problem. ⏱ Complexity Analysis Time Complexity: O(n²) Space Complexity: O(n) 💡 Key Learnings - Breaking problem into left & right subtrees simplifies logic - Recursive problems often hide DP patterns - This is a classic example of Catalan numbers - Counting problems are often easier than constructing solutions #100DaysOfDSA #Day97 #LeetCode #DynamicProgramming #BST #Catalan #Algorithms #DSA #CodingJourney
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