🚀 Day 25 of 100 Days of LeetCode 📘 Problem: Remove Nth Node from End of List 💻 Language: Java ✅ Status: Accepted — Runtime: 0 ms ⚡ (Beats 100%) Today’s challenge was about working with Linked Lists, one of the most fundamental yet tricky data structures in DSA. The problem required removing the Nth node from the end — which tested how well I could use two-pointer techniques efficiently. ✨ Key Learnings: The two-pointer approach simplifies traversal logic beautifully 🎯 Dummy nodes are game-changers for clean code and edge case handling Linked Lists demand visualization — drawing it out helps a lot! Every accepted solution sharpens my ability to reason through edge cases and optimize thought flow 🔄 #Day25 #100DaysOfCode #LeetCode #Java #LinkedList #ProblemSolving #CodingJourney #DSA #SoftwareDevelopment #CodeEveryday #KeepLearning
Sunny Kumar’s Post
More Relevant Posts
-
📌 Day 13/100 - Valid Anagram (LeetCode 242) 🔹 Problem: Given two strings s and t, determine whether t is an anagram of s. An anagram is formed by rearranging the letters of one word to create another word — meaning both strings must have the same characters with the same frequency. 🔹 Approach: First, check if both strings are of equal length — if not, they can’t be anagrams. Convert both strings into character arrays. Sort both arrays and compare them using Arrays.equals(). If both sorted arrays are identical, the strings are anagrams. 🔹 Key Learning: Sorting can simplify comparison-based string problems. Always check base conditions (like length) to avoid unnecessary computation. This approach has a time complexity of O(n log n) due to sorting, which is efficient enough for this problem. Every solved challenge is another letter added to the dictionary of progress! 🚀 #100DaysOfCode #LeetCode #Java #ProblemSolving #DSA #CodingJourney #Consistency
To view or add a comment, sign in
-
-
📌 Day 14/100 - Group Anagrams (LeetCode 49) 🔹 Problem: Given an array of strings, group the anagrams together. An anagram is a word formed by rearranging the letters of another — like “eat”, “tea”, and “ate”. 🔹 Approach: Traverse through each word in the array. Sort its characters alphabetically to form a key. Use a HashMap to group words with the same key. Return all grouped lists as the final result. 🔹 Key Learning: ✅ Sorting helps identify similar string patterns. ✅ HashMaps make grouping efficient and clean. ✅ Small logical steps lead to elegant solutions. Consistent effort turns complexity into clarity 💪 #100DaysOfCode #LeetCode #Java #ProblemSolving #DSA #CodingJourney #LearningEveryday
To view or add a comment, sign in
-
-
📌 Day 2/100 – Remove Element (LeetCode 27) 🔹 Problem: Given an integer array nums and a value val, remove all instances of that value in-place and return the new length of the array. The order of elements can be changed. 🔹 Approach: Used the two-pointer technique to efficiently modify the array in-place. One pointer iterates through the array, while the other tracks the position to overwrite non-val elements. Returned the position of the second pointer as the new length. 🔹 Key Learning: Strengthened understanding of in-place array manipulation. Improved logic building for pointer movement and conditional overwriting. Learned how to minimize extra space usage while maintaining readability and clarity. Another small yet powerful step toward mastering array-based problems! 💻 🔥 #100DaysOfCode #LeetCode #Java #ProblemSolving #TwoPointers #DSA #CodingJourney
To view or add a comment, sign in
-
-
23/30 days✅ Solved LeetCode Problem : #70 – Climbing Stairs The challenge was to determine how many distinct ways one can reach the top of a staircase with n steps, where at each step you can either climb 1 or 2 steps. The logic behind the problem is similar to the Fibonacci sequence, where each state depends on the sum of the previous two states. I implemented the solution in Java, using an iterative approach with three variables to optimize space complexity. Instead of using recursion or an array, the approach updates values in constant space (O(1)) while maintaining linear time complexity (O(n)). Here’s the logic in brief: Initialize a = 0, b = 1, and c = 1. For each step, compute c = a + b, then shift values forward (a = b, b = c). Return c as the total number of distinct ways to reach the top. #LeetCode #Java #DynamicProgramming #ProblemSolving #CodingJourney
To view or add a comment, sign in
-
-
#100DaysOfCode – Day 89 Linked Lists & Big Number Addition 🔹 Problem: Add Two Numbers You’re given two non-empty linked lists representing numbers. Each node stores a single digit, and the digits are stored in reverse order. 🔹 My Approach: Used a dummy node to simplify list construction. Traversed both lists simultaneously while managing the carry. Created new nodes for each digit of the sum using modular arithmetic. Continued until both lists and carry were fully processed. Time Complexity: O(max(N, M)) Space Complexity: O(max(N, M)) Even in linked lists, clean logic + careful pointer handling can simplify complex problems. This challenge reinforced how breaking big tasks into smaller, consistent steps leads to efficient solutions. #takeUforward #100DaysOfCode #LinkedList #Java #ProblemSolving #LeetCode #DSA #CodingJourney #CodeNewbie #ChitkaraUniversity
To view or add a comment, sign in
-
-
Solved: LeetCode Problem 922 – Sort Array By Parity II 📌 Difficulty Level: Easy 💻 Language Used: Java 🧠 Topics: Arrays, Index Manipulation, Two-Pointer 🧩 Problem Overview: Rearrange the array so that elements at even indices are even numbers and elements at odd indices are odd numbers. 🎯 Key Learnings: ✅ Practiced separate pointer movement for even/odd indices ✅ Learned how to skip indices in steps of 2 for efficiency ✅ Strengthened control flow in condition-based pointer increment ✅ Designed an O(n) solution without extra space 🛠 Skills Practiced: Index Management Array Rearrangement Two-Pointer Optimization In-place Logic Building ⚡️ Problems like this sharpen thinking about index constraints and help in mastering array partitioning & arrangement patterns. #LeetCode #Java #RotateArray #ProblemSolving #Arrays #LogicBuilding #100DaysOfCode #CodeNewbie #TechCareers #WomenInTech #LearningInPublic #BuildInPublic #DeveloperJourney #CleanCode #DSA #AlgorithmPractice #CodingInterviewPrep #SoftwareDevelopment #AfrozCodes #DailyCoding #CrackTheCodingInterview #TechForAll
To view or add a comment, sign in
-
-
💡 LeetCode #15 — 3Sum Today I solved LeetCode Problem 15: 3Sum 🔍 Problem Summary: Given an integer array nums, return all unique triplets (a, b, c) such that: a + b + c = 0 The solution must not contain duplicate triplets. Key Idea: Use sorting + two pointers to reduce the time from O(n³) to O(n²). Steps: Sort the array. Fix one number (nums[f]) in each iteration. Use two pointers (i and j) to find pairs whose sum equals -nums[f]. Skip duplicates for both the fixed index and the pointer values. This efficiently finds all unique triplets. #LeetCode #Java #DSA #TwoPointers #ProblemSolving #CodingChallenge #Algorithms
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
-
-
Winter may be coming ❄️, but the code still runs fast ⚔️ Cracked one of the toughest LeetCode Hard problems – Median of Two Sorted Arrays 🔥 Hit 100% runtime efficiency (1 ms) with clean and optimized binary search logic 🧠 This one tested everything — edge cases, math logic, and patience 😅 But as they say… “You win or you debug again.” 🐉 #LeetCode #DSA #CodingJourney #BinarySearch #Java #ProblemSolving #WinterIsComing #GameOfCodes
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
-
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