🚀 Day 6 of #100DaysOfDSA (Java) Today I worked on Pattern Problems ⭐ Focused on: Nested loops Row & column logic Understanding how output structure maps to loop structure At first, patterns feel confusing. But once you understand how rows and columns interact, everything becomes structured. Big takeaway today 👇 Patterns improve logical thinking and control over loops — which is the foundation for solving complex problems later. Small practice. Strong foundation. Day 6 ✅ Consistency is building discipline. #DSA #Java #CodingJourney #100DaysOfCode #ProblemSolving #FutureDeveloper #LearningInPublic
Java DSA Day 6: Patterns and Loop Logic
More Relevant Posts
-
Day 34 – Maximum Count of Positive and Negative Integers Solved a problem involving a sorted array where the goal was to determine whether positive or negative numbers appear more frequently. Key Learnings: Iterating through arrays to count positive and negative values #DSA #Java #Arrays #ProblemSolving #CodingPractice #DataStructures
To view or add a comment, sign in
-
-
Day 18/30 – Remove Duplicates from Sorted List 🚀 Problem: Remove duplicate nodes from a sorted linked list. Key Insight: Since the list is sorted, duplicates will be adjacent. Approach: • Traverse using one pointer • If current.val == current.next.val → skip node • Else → move forward Time Complexity: O(n) Space Complexity: O(1) Simple logic. Clean pointer handling. #30DaysOfCode #Java #DSA #LinkedList #InterviewPrep
To view or add a comment, sign in
-
-
Day 18 of #100DaysOfDSA (Java) Today I explored Divide and Conquer, a powerful problem-solving technique used in many efficient algorithms. Topics covered: 🔹 Merge Sort (stable, O(n log n)) 🔹 Quick Sort (efficient average case sorting) 🔹 Searching in a Sorted & Rotated Array 🔹 Understanding how problems can be broken into smaller subproblems and solved recursively Key takeaway: Divide and Conquer is not just about sorting — it’s about thinking recursively and optimizing solutions by reducing problem size. Also realized the importance of choosing the right algorithm: Merge Sort → stable and predictable Quick Sort → faster in practice but depends on pivot Day 18 From basic logic → to algorithmic thinking. #DSA #Java #DivideAndConquer #MergeSort #QuickSort #100DaysOfCode #ProblemSolving #DeveloperJourney
To view or add a comment, sign in
-
-
#day334 of #1001daysofcode problem statement (1009): Complement of Base 10 Integer 💡 Approach: To find the complement of a number, I converted it into binary and flipped every bit (0 → 1 and 1 → 0). After flipping the bits, the resulting binary string was converted back to decimal. Example: 5 → Binary: 101 Complement: 010 → 2 ⏱ Time Complexity: O(log n) 🧠 Space Complexity: O(log n) #1001DaysOfCode #DSA #Java #LeetCode #ProblemSolving Shivam Mahajan #leetcode
To view or add a comment, sign in
-
-
Day 52/100 Completed ✅ 🚀 Solved LeetCode – Merge Intervals (Java) ⚡ Implemented an interval merging approach by first sorting intervals based on their start times and then traversing them to combine overlapping ranges. 🧠 Used comparison logic to detect overlaps and update interval boundaries, ensuring that all overlapping intervals are merged efficiently. This approach avoids redundant checks and processes the intervals in a single pass after sorting. 💯 Strengthened understanding of interval problems, sorting strategies, and greedy traversal techniques commonly used in real-world scheduling and timeline merging scenarios. Profile: https://lnkd.in/gaJmKdrA #LeetCode #100DaysOfCode #Java #DSA #CodingPractice #ProblemSolving
To view or add a comment, sign in
-
-
#day329 of #1001daysofcode problem statement (1784): Check if Binary String Has at Most One Segment of Ones Approach 1: If the pattern "01" appears in the string, it means the sequence of '1's was broken Approach 2: Traverse the string and count segments of consecutive '1's. Whenever a '1' is found, skip the entire sequence of continuous '1's and increase the segment count. If the number of segments of '1's is exactly one, the condition is satisfied. --both approaches have same time and space complexity. ⏱ Time Complexity: O(n) 🧠 Space Complexity: O(1) #1001DaysOfCode #DSA #Java #LeetCode #ProblemSolving Shivam Mahajan #leetcode
To view or add a comment, sign in
-
-
Day 29/100 – LeetCode Challenge 🚀 Problem: Same Tree Approach: Used recursive traversal Compared corresponding nodes of both trees Checked: both nodes null → identical one null → not identical values mismatch → not identical recursively compared left and right subtrees Time Complexity: O(n) Space Complexity: O(h) Key takeaway: Many tree comparison problems reduce to simultaneous traversal of both trees. #LeetCode #100DaysOfCode #DSA #Java #BinaryTree #ProblemSolving
To view or add a comment, sign in
-
-
#day328 of #1001daysofcode problem statement (1758): Minimum Changes To Make Alternating Binary String An alternating binary string can only follow two patterns: "010101..." or "101010...". I counted the number of changes required to convert the string into both patterns and returned the minimum of the two. ⏱Time Complexity: O(n) 🧠Space Complexity: O(1) Consistency check ✅ One LeetCode problem a day to sharpen problem-solving skills. #1001DaysOfCode #DSA #Java #LeetCode #ProblemSolving Shivam Mahajan #leetcode
To view or add a comment, sign in
-
-
🚀 Day 36 / 100 | Insert Interval -Intuition: -This problem is based on interval merging with insertion. The Simple idea is to insert the new interval in the correct position and merge if overlapping occurs. If the current interval ends before the new interval starts, there is no overlap, so add it directly. If the current interval starts before or equal to the new interval end, they overlap. "So instead of adding separately, update the new interval by taking the minimum start and maximum end". Once merging is done, add the merged interval and then add the remaining intervals. -Approach: O(n) Traverse all intervals from left to right. First, add all intervals that come before the new interval (no overlap). Then merge all overlapping intervals by updating: new.start = min(new.start, current.start) new.end = max(new.end, current.end) Add the merged interval to result. Finally, add all remaining intervals that come after. -Complexity: Time Complexity: O(n) Space Complexity: O(n) #100DaysOfCode #Java #DSA #LeetCode
To view or add a comment, sign in
-
-
𝐃𝐚𝐲 𝟒𝟕/𝟑𝟔𝟓 🚀 📌 𝐋𝐞𝐞𝐭𝐂𝐨𝐝𝐞 𝐏𝐎𝐓𝐃: 𝐂𝐡𝐞𝐜𝐤 𝐢𝐟 𝐁𝐢𝐧𝐚𝐫𝐲 𝐒𝐭𝐫𝐢𝐧𝐠 𝐇𝐚𝐬 𝐚𝐭 𝐌𝐨𝐬𝐭 𝐎𝐧𝐞 𝐒𝐞𝐠𝐦𝐞𝐧𝐭 𝐨𝐟 𝐎𝐧𝐞𝐬 Continuing my 𝟑𝟔𝟓 𝐃𝐚𝐲𝐬 𝐨𝐟 𝐂𝐨𝐝𝐞 journey with a focus on 𝐩𝐫𝐨𝐛𝐥𝐞𝐦-𝐬𝐨𝐥𝐯𝐢𝐧𝐠, 𝐃𝐒𝐀, 𝐚𝐧𝐝 𝐜𝐨𝐧𝐬𝐢𝐬𝐭𝐞𝐧𝐜𝐲. 💪 🔎 𝐀𝐩𝐩𝐫𝐨𝐚𝐜𝐡: A valid binary string can contain only one continuous segment of 1s. If the pattern "01" appears, it means a new segment of 1s starts after zeros, which violates the condition. 🔍 𝐀𝐥𝐠𝐨𝐫𝐢𝐭𝐡𝐦 𝐮𝐬𝐞𝐝: String pattern detection. ⏱ 𝐓𝐢𝐦𝐞 𝐂𝐨𝐦𝐩𝐥𝐞𝐱𝐢𝐭𝐲: 𝐎(𝐧) 🧠 𝐒𝐩𝐚𝐜𝐞 𝐂𝐨𝐦𝐩𝐥𝐞𝐱𝐢𝐭𝐲: 𝐎(𝟏) 📈 𝐊𝐞𝐲 𝐭𝐚𝐤𝐞𝐚𝐰𝐚𝐲: Sometimes the simplest solution comes from recognizing a pattern rather than iterating through complex conditions. #LeetCode #LeetCodeDaily #365DaysOfCode #DSA #Java #Strings #ProblemSolving #LearningInPublic 👨💻 🔗 Problem link in comments 👇
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