🚀 Day 44 Out of #365DayOfCode - LeetCode Today I worked on the Set Matrix Zeroes problem, where the goal is to modify a 2D matrix such that if any element is 0, its entire row and column are set to 0. I implemented an efficient solution with O(m × n) time complexity and optimized space usage by carefully handling matrix traversal and edge cases. This problem helped me strengthen my understanding of: 2D array manipulation In-place updates Optimizing space complexity Handling edge cases in algorithms Consistent practice is helping me improve my problem-solving skills step by step. 🚀 #DSA #Java #ProblemSolving #CodingPractice #365DaysOfCode Github link: https://lnkd.in/gGUy_MKZ
Day 44 of 365 Days of Code: Set Matrix Zeroes Problem
More Relevant Posts
-
🚀 #100DaysOfCode | Day 41 💻 LeetCode – Add to Array-Form of Integer Today I solved a problem focused on array manipulation and digit-by-digit addition. 🔎 Problem: An integer is given in array form, where each element represents a digit. The task is to return the array representation of num + k. 💡 Approach: Instead of converting the array into a number, I simulated manual addition from the last digit, just like we do on paper. ✔ Traverse the array from right to left ✔ Add digits with k and manage the carry ✔ Store the result digits and reverse at the end This approach efficiently handles large inputs and avoids integer overflow. Small problems like this strengthen logic building and problem-solving skills. #LeetCode #DSA #100DaysOfCode #ProblemSolving #Java #CodingJourney #SoftwareDeveloper #TechGrowth
To view or add a comment, sign in
-
-
🚀 Day 20 of #100DaysOfCode Solved 54. Spiral Matrix on LeetCode 🌀 🧠 Key insight: Spiral traversal is all about maintaining boundaries. By shrinking the top, bottom, left, and right limits after each pass, we can cover every element exactly once. ⚙️ Approach: 🔹Maintain four pointers: top, down, left, right 🔹Traverse: 🔹Left → Right (top row) 🔹Top → Bottom (right column) 🔹Right → Left (bottom row) 🔹Bottom → Top (left column) 🔹Update boundaries after each traversal ⏱️ Time Complexity: O(m × n) 📦 Space Complexity: O(1) (excluding output list) #100DaysOfCode #LeetCode #DSA #Matrix #Java #ProblemSolving #LearningInPublic #CodingJourney
To view or add a comment, sign in
-
-
#Day28 of #365DaysOfCode Today’s LeetCode practice: 🔹 Word Search (LeetCode 79) Solved a backtracking problem where I had to check whether a given word exists in a 2D board by moving horizontally or vertically through adjacent cells. 💡 Key Insight: Start exploring from every cell. If the character matches the current letter of the word, move in all 4 possible directions. Mark the cell as visited and revert the change if the path doesn’t lead to a solution. On to Day 29 🔥 #LeetCode #Java #DSA #ProblemSolving #CodingJourney #Backtracking #Recursion
To view or add a comment, sign in
-
-
Most problems aren’t about brute force. They’re about recognizing patterns. Today’s focus: Day 48/100 – Sliding Window Mastery 🚀(Longest Subarray with At Most 2 Distinct Elements) Instead of checking every possible subarray (O(n²)), I used the Sliding Window + HashMap approach to optimize it to O(n) time complexity. 🔹 Expand the window using r 🔹 Track frequencies using HashMap 🔹 Shrink from l when distinct elements exceed 2 🔹 Update maximum length dynamically Clean. Efficient. Scalable. Consistent practice is making pattern recognition faster and more intuitive every day. #Day48 #100DaysOfCode #DSA #Java #CodingJourney #SlidingWindow #ProblemSolving #LeetCode
To view or add a comment, sign in
-
-
Day 16 | LeetCode Daily Solved LeetCode Problem #173 – Binary Search Tree Iterator Concept: • Inorder traversal using stack • Iterator design over tree structures Key Learnings: • BST inorder traversal naturally gives sorted order • Using a stack allows lazy traversal with O(1) average time per operation Keeping the daily streak alive and strengthening tree traversal patterns. Submission link: https://lnkd.in/gMPEhX_m #LeetCode #DSA #BinarySearchTree #Trees #Java #ProblemSolving
To view or add a comment, sign in
-
-
🚀 𝐃𝐚𝐲 59 / 100 𝐃𝐚𝐲𝐬 𝐨𝐟 𝐂𝐨𝐝𝐞 🚀 Today’s problem: 𝐋𝐞𝐞𝐭𝐂𝐨𝐝𝐞 238 – 𝐏𝐫𝐨𝐝𝐮𝐜𝐭 𝐨𝐟 𝐀𝐫𝐫𝐚𝐲 𝐄𝐱𝐜𝐞𝐩𝐭 𝐒𝐞𝐥𝐟 A classic problem that truly tests logical thinking + space-time optimization. 🔹 What I learned & practiced today: 𝐏𝐫𝐞𝐟𝐢𝐱 𝐩𝐫𝐨𝐝𝐮𝐜𝐭 & 𝐬𝐮𝐟𝐟𝐢𝐱 𝐩𝐫𝐨𝐝𝐮𝐜𝐭 technique Solving without 𝐮𝐬𝐢𝐧𝐠 𝐝𝐢𝐯𝐢𝐬𝐢𝐨𝐧 𝐨𝐩𝐞𝐫𝐚𝐭𝐨𝐫 Achieving 𝐎(𝐧) 𝐭𝐢𝐦𝐞 𝐜𝐨𝐦𝐩𝐥𝐞𝐱𝐢𝐭𝐲 O(1) extra space optimization (excluding output array) #LeetCode #Java #DSA #Arrays #PrefixSum #ProblemSolving #CodingJourney #Consistency #SoftwareDeveloper #LearningDaily #DeveloperMindset
To view or add a comment, sign in
-
-
#Day58 of my second #100DaysOfCode Today’s problem was about carefully handling overlapping intervals. DSA • Solved Merge Intervals (LeetCode 56) • Implemented a brute force approach by checking and merging overlapping intervals → O(2n) + O(n log n) time • Implemented the optimal approach by sorting intervals and merging them in a single traversal → O(n log n) + O(n) time • Key idea: once intervals are sorted by start time, overlapping ranges can be merged efficiently in one pass These interval problems really test attention to detail with edge cases. #DSA #Algorithms #LeetCode #Java #100DaysOfCode #WomenWhoCode #BuildInPublic #LearningInPublic
To view or add a comment, sign in
-
-
🚀 Day 73/100 of my DSA Journey ✅ Problem solved today: LeetCode 1461 – Check If a String Contains All Binary Codes of Size K 🧠 What I focused on: Using a HashSet to store all substrings of length k Sliding window technique to generate substrings efficiently Understanding why we only need to check if the number of unique substrings equals 2^k Handling edge cases when string length is smaller than k This problem nicely combined strings + sliding window + hashing logic. 📌 Key takeaway: Sometimes the solution is just counting unique patterns efficiently. 📈 Day 73 done. Consistency continues. #LeetCode #DSA #SlidingWindow #Strings #Hashing #Java #ProblemSolving #Consistency #LearningInPublic #100DaysOfCode
To view or add a comment, sign in
-
🚀 Day 20/60 Completed – LeetCode Problem of the Day Challenge Today’s challenge: Check if Binary String Has at Most One Segment of Ones The problem asks us to determine whether a binary string contains at most one continuous segment of '1's. 🧠 Approach & Key Learnings: • Traversed the string once from left to right. • Once a segment of '1's starts, we track it. • If we encounter '0' after the first segment of '1's, we mark that a break occurred. • If another '1' appears after that zero, it means there is more than one segment of ones → return false. • Otherwise, the string contains only one contiguous segment of ones → return true. ⚙️ Key Concepts Practiced: • String traversal • Segment detection in binary strings • Boolean flag tracking • Writing clean linear-time logic Small problem, but a good exercise in carefully tracking patterns while scanning a string. 20 days down. Consistency is getting stronger every day. ⚡ 40 days to go — staying locked in. 🔥 #LeetCode #60DaysChallenge #ProblemOfTheDay #DSA #Java #CodingJourney #Consistency #SoftwareEngineering
To view or add a comment, sign in
-
-
Day 12/100 – LeetCode Challenge Problem Solved: Permutations Today’s problem was about generating all possible permutations of a given array of distinct integers. This is a classic backtracking problem where the objective is to build permutations step by step while ensuring each element is used exactly once in every arrangement. I implemented a recursive solution supported by a boolean array to track which elements were already included in the current permutation. At every recursive call, I select an unused element, add it to the current list, mark it as used, and continue exploring deeper. Once a permutation reaches the required length, it is added to the result set. Then comes the most important part — backtracking. I remove the last element and reset its state so other combinations can be explored. Time Complexity: O(n × n!) Space Complexity: O(n) excluding the output list #100DaysOfLeetCode #Java #Backtracking #Recursion #Algorithms #ProblemSolving #Consistency
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