Day 13/100 | #100DaysOfDSA Today’s problem: 4Sum Basically an extension of 3Sum — but with an extra layer of complexity. Approach: • Sort the array • Fix two numbers • Use two pointers for the remaining pair • Carefully skip duplicates Time complexity: O(n³) Biggest challenge? Handling duplicates cleanly without missing valid combinations. This one really tested patience and edge-case thinking. Stacking patterns day by day. 🚀 #100DaysOfCode #LeetCode #DSA #Algorithms #Java #CodingJourney #ProblemSolving #InterviewPrep #TechCommunity #SoftwareDeveloper #ComputerScience #CodingLife #Consistency #Programmers #TechGrowth
Yogesh ..’s Post
More Relevant Posts
-
Day 18/100 | #100DaysOfDSA Today’s problem: Longest Common Prefix Many strings. One shared start. Approach: • Take first string as prefix • Compare with others • Shrink prefix until it matches • If it becomes empty → no common prefix Time complexity: O(n × m) Big takeaway: Sometimes the solution isn’t adding more — it’s trimming smartly. Less guesswork. More refinement. 💡✨ #100DaysOfCode #LeetCode #DSA #Algorithms #Java #CodingJourney #ProblemSolving #InterviewPrep #TechCommunity #SoftwareEngineer #ComputerScience #Consistency #Programmers #TechGrowth
To view or add a comment, sign in
-
-
Day 17/100 | #100DaysOfDSA Today’s problem: Valid Anagram Two strings. Same letters. Same frequency. That’s it. Approach: • Use a frequency array (size 26) • Increment for first string • Decrement for second string • If all values → 0, it’s an anagram Time complexity: O(n) Big takeaway: When order doesn’t matter — count. Simple idea. Efficient solution. Clean execution. ⚡✨ #100DaysOfCode #LeetCode #DSA #Algorithms #Java #CodingJourney #ProblemSolving #InterviewPrep #TechCommunity #SoftwareEngineer #ComputerScience #Consistency #Programmers #TechGrowth
To view or add a comment, sign in
-
-
Day 33/100 | #100DaysOfDSA 🌳💻 Today’s problem: Binary Tree Postorder Traversal Postorder follows a simple rule: Left → Right → Root Approach: • Use recursion • Traverse left subtree • Traverse right subtree • Add the root at the end This ensures children are processed before the parent. Time Complexity: O(n) Space Complexity: O(h) (recursion stack) Big takeaway: Tree traversals are just different visiting orders — mastering them builds strong tree intuition. Stacking tree patterns daily. 🚀 #100DaysOfCode #LeetCode #DSA #BinaryTree #Trees #Java #CodingJourney #ProblemSolving #InterviewPrep #TechCommunity #SoftwareEngineer #Consistency #Programmers #TechGrowth
To view or add a comment, sign in
-
-
Day 35/100 | #100DaysOfDSA 🌳💻 Today’s problem: Same Tree The goal is to determine whether two binary trees are identical — meaning they have the same structure and the same node values. Approach: • Use recursion to traverse both trees simultaneously • If both nodes are null → they match • If one node is null and the other isn’t → trees are different • If node values differ → trees are different • Recursively check the left and right subtrees Both trees must match at every node for them to be considered the same. Time Complexity: O(n) Space Complexity: O(h) (recursion stack) Big takeaway: When comparing two trees, traverse them in parallel and validate structure and values at each step. Simple logic, but a great exercise for strengthening recursive tree thinking. One more tree pattern learned. 🚀 #100DaysOfCode #LeetCode #DSA #BinaryTree #Trees #Java #CodingJourney #ProblemSolving #InterviewPrep #TechCommunity #SoftwareEngineer #Consistency #Programmers #TechGrowth
To view or add a comment, sign in
-
-
Day 32/100 | #100DaysOfDSA 🌳✨ Today’s problem: Symmetric Tree A tree is symmetric if the left subtree is the mirror of the right subtree. Approach: • Use two queues • Compare left and right nodes together • Check mirror conditions at every step If values mismatch → Not symmetric. Time Complexity: O(n) Space Complexity: O(n) Big takeaway: Symmetry in trees is just mirror comparison at every level. Understanding trees deeper every day. 🚀 #100DaysOfCode #LeetCode #DSA #BinaryTree #Trees #Java #CodingJourney #ProblemSolving #InterviewPrep #TechCommunity #SoftwareEngineer #Consistency #Programmers #TechGrowth
To view or add a comment, sign in
-
-
Another day another problem💪 In this problem, the array is sorted but rotated at an unknown pivot. Instead of using a linear search (O(n)), I applied a binary search strategy to maintain O(log n) time complexity. 💡 Key Learnings: Handling edge cases in rotated arrays Understanding how to calculate the real mid index after rotation Strengthening binary search fundamentals Consistent practice is helping me improve my problem-solving and DSA skills step by step. 💪 #LeetCode #DSA #BinarySearch #Java #Coding #ProblemSolving #SoftwareDeveloperJourney
To view or add a comment, sign in
-
-
Day 5/60 – LeetCode Challenge 🔥 Problem: Contains Duplicate (LeetCode 217) Today’s concept: Hashing 💡 The question is simple: Given an array, return true if any value appears at least twice. Brute force approach? Compare every pair → O(n²) ❌ Better approach? Use a HashSet. Intuition: As I traverse the array: • Add the element to the set if it return false this means element already exist in the set -> just return true • Otherwise → return false Why this works? Because a HashSet allows O(1) average time complexity for lookup. So instead of comparing every element, we just check if we’ve seen it before. Time Complexity: O(n) Space Complexity: O(n) Key Learning: When the question involves: “Check if element already exists” or “Detect duplicates” Think → Hashing Day 5 completed ✅ On to Day 6 🚀 #LeetCode #DSA #Hashing #Java #CodingChallenge #PlacementPreparation
To view or add a comment, sign in
-
-
💻 Day 8 of #GeekStreak60 🚀 Solved today’s Problem of the Day: Longest Substring with K Unique Characters. 🔎 Problem Idea: Given a string s and an integer k, find the length of the longest substring that contains exactly k distinct characters. If no such substring exists, return -1. 🧠 Approach Used: • Used the Sliding Window technique • Maintained a frequency array to track character occurrences • Expanded the window to include new characters • Shrunk the window whenever distinct characters exceeded k • Updated the maximum length when exactly k unique characters were present ⚡ Key Learning: How the sliding window technique can efficiently handle substring problems involving constraints like distinct characters, reducing time complexity to O(n). Consistency is the goal — learning something new every day! 💪 #geekstreak60 #DSA #Java #SlidingWindow #Strings #ProblemSolving #CodingJourney @geeksforgeeks @NPCI_NPCI
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
-
-
This looked like a very easy problem… And it was. But it also reminded me of something important. 🚀 Day 57/365 — DSA Challenge Solved: Check If N and Its Double Exist The task: Check if there exists: arr[i] = 2 * arr[j] where i ≠ j My first approach: Check every pair. Two loops. Simple and clear. It worked. But… ⏱ O(n²) Then I thought: Do I really need to check everything? 💡 Better idea: Use a HashSet For each number: Check if 2 * num exists or num / 2 exists Now the complexity becomes: O(n) This problem taught me: Even easy problems have better solutions. And the real skill is not solving… It’s optimizing. Code (Brute Force) 👇 https://lnkd.in/dad5sZfu #DSA #LearningInPublic #Java #LeetCode #Coding #Consistency
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