#Day98 of #100DaysOfCode Learned Binary Search, an efficient searching algorithm for sorted arrays. Implemented logic to find an element by repeatedly dividing the search space. Focused on understanding how optimized searching works compared to linear search. #Java #DSA #BinarySearch #100DaysOfCode
More Relevant Posts
-
Day 77 - Binary Tree Postorder Traversal Implemented postorder traversal using recursion. Approach: • Traverse left subtree • Traverse right subtree • Visit node Time Complexity: O(n) Space Complexity: O(h) #Day77 #LeetCode #BinaryTree #DSA #Java #CodingJourney #ProblemSolving
To view or add a comment, sign in
-
-
Day 74 - Univalued Binary Tree Checking whether all nodes in a binary tree share the same value using recursion. Approach: • Store root value • Traverse the tree recursively • Compare each node with root value • Return false if any mismatch is found Key Insight: Recursion simplifies tree traversal and validation Time Complexity: O(n) #Day74 #LeetCode #Java #CodingPractice #TechJourney #DSA #BinaryTree
To view or add a comment, sign in
-
-
Day 85 – Binary Tree Postorder Traversal Worked on traversing a binary tree in postorder (Left → Right → Root) using both recursive and iterative approaches. Key Learnings: Implemented recursion for clean and intuitive traversal Explored iterative solution using stack and reverse logic #DSA #Java #BinaryTree #DFS #Stack #Recursion #ProblemSolving #CodingPractice
To view or add a comment, sign in
-
-
Day 75 - Count Complete Tree Nodes Finding the total number of nodes in a complete binary tree using recursion. Approach: • Traverse the tree recursively • Count left subtree • Count right subtree • Add 1 for current node Time Complexity: O(n) Space Complexity: O(h) #Day75 #LeetCode #Java #CodingPractice #TechJourney #DSA #BinaryTree
To view or add a comment, sign in
-
-
Day 70 - Next Greater Node Understanding how to find the next larger value for each node using stack optimization. Approach: • Convert linked list → array for easy indexing • Use a stack to track indices • Compare current value with stack top • Update results when a greater value is found Key Insight: Monotonic stack helps avoid unnecessary comparisons Time Complexity: O(n) Space Complexity: O(n) #Day70 #LeetCode #Java #CodingPractice #TechJourney #DSA #LinkedList
To view or add a comment, sign in
-
-
🚀 Day 35 of my #100DaysOfCode Journey Today, I solved the LeetCode problem: Valid Anagram Problem Insight: Given two strings, check if one is an anagram of the other. Approach: • First, check if the strings have the same length; if not, return false • Convert both strings to character arrays • Sort both arrays • Compare the sorted arrays — if equal, the strings are anagrams Time Complexity: • O(n log n) — due to sorting the arrays Space Complexity: • O(n) — for the character arrays Key Learnings: • Sorting is a simple and effective way to compare character compositions • Edge cases like different lengths should be handled first • Breaking the problem into small steps makes it easy to reason about Takeaway: Sometimes, sorting can reduce a seemingly complex problem into a simple comparison. #DSA #Java #LeetCode #100DaysOfCode #CodingJourney #ProblemSolving #Strings
To view or add a comment, sign in
-
-
Day 92/100 Completed ✅ 🚀 Solved LeetCode: Median of Two Sorted Arrays (Java) ⚡ Used a two-pointer approach to efficiently find the median without fully merging the arrays. Focused only on tracking the required middle elements, reducing unnecessary space usage. 🧠 Key Learnings: • Applying two-pointer technique on sorted arrays • Handling edge cases when one array is exhausted • Understanding median logic for even vs odd total length • Optimizing space by avoiding full array merge 💡 This problem highlighted how tracking only what’s necessary can lead to better performance and cleaner solutions. Profile: https://lnkd.in/gaJmKdrA #leetcode #datastructures #algorithms #java #twopointers #array #coding #problemSolving
To view or add a comment, sign in
-
-
Day 32/50 🚀 — Search Insert Position (Binary Search) Today’s problem reinforced one of the most important concepts in DSA — Binary Search 🔍 🔹 Applied efficient search in a sorted array 🔹 Focused on boundary conditions 🔹 Learned how to return the correct insert position when target isn’t found Key insight: Binary search isn’t just about finding an element — it’s about narrowing down the answer space intelligently. 💡 Returning left at the end ensures we get the exact position where the target should be inserted. Performance highlights: ⚡ Runtime: 0 ms (100%) 📦 Memory: Optimized #Day32 #LeetCode #BinarySearch #DSA #Java #CodingJourney #50DaysOfCode #ProblemSolving
To view or add a comment, sign in
-
-
Day 68/100 Completed ✅ 🚀 Solved LeetCode – Split Array Largest Sum (Java) ⚡ Applied an efficient Binary Search on Answer approach to split the array into k subarrays such that the largest subarray sum is minimized. Instead of trying all possible splits, optimized the solution by searching within the range of maximum element and total sum, and validating using a greedy strategy. 🧠 Key Learnings: Identifying binary search applicability in partition-based problems Defining search space using max element (lower bound) and total sum (upper bound) Using greedy logic to check feasibility of splitting into k subarrays Minimizing the maximum subarray sum through efficient validation 💯 This problem strengthened my understanding of partition problems and reinforced how binary search can be used for optimization rather than direct searching. 🔗 Profile: https://lnkd.in/gaJmKdrA #leetcode #datastructures #algorithms #java #binarysearch #problemSolving #100DaysOfCode
To view or add a comment, sign in
-
-
Day 81 - Balanced Binary Tree Checked whether a binary tree is height-balanced using a bottom-up approach. Approach: • Recursively compute height of left and right subtrees • If height difference > 1 → not balanced • Use -1 as a signal to stop early Time Complexity: O(n) Space Complexity: O(h) #Day81 #LeetCode #BinaryTree #DSA #Java #CodingJourney #ProblemSolving
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