🚀 Day 21 of #128DaysOfCode 🔍 Key Learnings: Efficient searching in O(log n) Using low & high to narrow the range Finding correct position even if target is absent 🧠 Approach: Compare mid with target → move left/right → return index or insert position Consistency is key 🔥 #DSA #Java #CodingJourney #PlacementPreparation
Efficient Searching in O(log n) with Binary Search
More Relevant Posts
-
Day 69 - Remove Linked List Elements Working with linked lists to efficiently remove all nodes with a specific value using a dummy node approach. Time Complexity: O(n) Space Complexity: O(1) #Day69 #LeetCode #Java #LinkedList #DSA #ProblemSolving #CodingJourney
To view or add a comment, sign in
-
-
#Day95 of #100DaysOfCode Extended the previous number-to-words program to handle multiple digits. The program takes a number as input and prints each digit in its word form. Focused on improving logic by combining loops, string conversion, and conditional handling. #Java #MiniProject #100DaysOfCode
To view or add a comment, sign in
-
-
Day 60 - Remove Duplicates from Sorted List Worked on removing duplicate elements from a sorted linked list. Approach: • Traverse the list once • Compare current node with next node • Skip duplicate nodes by adjusting pointers Time Complexity: O(n) Space Complexity: O(1) #Day60 #LeetCode #Java #LinkedList #CodingPractice #DSA #TechJourney
To view or add a comment, sign in
-
-
Day 62 — LeetCode Progress (Java) Problem: Merge Strings Alternately Required: Given two strings word1 and word2, merge them by alternating characters, starting from word1. If one string is longer, append the remaining characters at the end. Idea: Use two pointers to traverse both strings simultaneously and build the result step by step. Approach: Initialize two pointers for both strings. Iterate while either string still has characters: Pick one character from word1 (if available) Then pick one from word2 (if available) Continue alternating until both strings are fully traversed. Time Complexity: O(n + m) Space Complexity: O(n + m) #LeetCode #DSA #Java #Strings #TwoPointers #Algorithms #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
Day 42 of consistency 💻🔥 Solved Add Two Numbers using linked lists — a classic problem that really tests understanding of pointers, carry handling, and edge cases. Key takeaways: Handling carry efficiently is crucial Dummy nodes make list problems much cleaner Iterative approach keeps space optimal Not the fastest runtime yet, but improvement is a process — optimizing step by step. Consistency > Perfection. #Day42 #LeetCode #DSA #Java #CodingJourney #ProblemSolving #100DaysOfCode
To view or add a comment, sign in
-
-
Day 75 – Linked List Cycle Detection Solved a problem to detect whether a linked list contains a cycle using an efficient two-pointer approach. Key Learnings: Applied Floyd’s Cycle Detection Algorithm Understood how different pointer speeds help detect loops Achieved optimal solution with O(1) space and O(n) time complexity #DSA #Java #LinkedList #TwoPointers #ProblemSolving #CodingPractice
To view or add a comment, sign in
-
-
Day: 94/365 📌 LeetCode POTD: Minimum Distance Between Three Equal Elements I Easy Key takeaways/Learnings from this problem: 1. This problem is a nice reminder that tracking indices smartly is often more important than the values themselves. 2. Keeping the last few occurrences of each element helps you quickly check valid triplets without brute force. 3. It shows how a simple hashmap or array tracking can turn an O(n³) idea into something efficient. #POTD #365DaysOfCode #DSA #Java #ProblemSolving #LearningInPublic #Consistency 🥷
To view or add a comment, sign in
-
-
Solved a problem where we need to check if two strings can be made equal using a special operation. The rule is: you can swap characters only if the distance between their positions is even. So basically, characters at even indices can only swap among themselves, and same for odd indices. Idea: Instead of actually swapping, I just counted characters separately for even and odd positions in both strings. If both match, then it’s possible — otherwise not. Simple concept, but interesting twist! 😊 #LeetCode #DSA #Java #ProblemSolving #CodingJourney
To view or add a comment, sign in
-
-
Can you predict the output? 🤔 int x = 5; System.out.println(x++ + ++x); Drop your answer below 👇 I’ll share the explanation in a few hours ⏳ #Java #CodingChallenge #DSA
To view or add a comment, sign in
-
🚀 Day 48/180 | #180DaysOfCode 📍 LeetCode | 💻 Java Solved: 1534. Count Good Triplets Used a brute-force triple nested loop to check all possible triplets and validate the given conditions using absolute differences. ⏱️ Time Complexity: O(n³) 📦 Space Complexity: O(1) Strengthening understanding of nested loop patterns and condition-based filtering. 💪 Consistency continues 🚀 #DSA #LeetCode #Java #CodingJourney #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