NeetCode 30 | LeetCode #33 | Search in Rotated Sorted Array Implemented modified binary search logic: Determine which side is sorted Adjust search boundaries based on the target’s position Time: O(log n) | Space: O(1) #LeetCode #NeetCode #Java #Algorithms #DataStructures #Optimization #Coding
More Relevant Posts
-
NeetCode 29 | LeetCode #153 | Find Minimum in Rotated Sorted Array Used binary search to find the rotation pivot. Compared nums[mid] with nums[right] to shrink search space efficiently. Time complexity: O(log n) | Space: O(1) #LeetCode #NeetCode #Java #Algorithms #DataStructures #Optimization #Coding
To view or add a comment, sign in
-
NeetCode 32 | LeetCode #21 | Merge Two Sorted Lists Used a dummy node and pointers to iteratively merge two lists in O(n + m) time and O(1) space. Also explored recursion for a cleaner, elegant solution. #LeetCode #NeetCode #Java #DataStructures #Algorithms #Optimization #Coding
To view or add a comment, sign in
-
NeetCode 16 | LeetCode #42 | Trapping Rain Water Applied two-pointer technique with max-left and max-right tracking to compute water trapped between bars. Optimized for linear time and constant space. #NeetCode #LeetCode #Java #Optimization #Algorithms #DataStructures #Coding
To view or add a comment, sign in
-
✅Day 71 of #100DaysOfLeetCode 1.📌Problem: Number of 1 Bits Given a positive integer n, write a function that returns the number of set bits in its binary representation (also known as the Hamming weight). 2.🟢 Difficulty: Easy 3.📍Topic: Bit Manipulation 4.🎯 Goal: Find the number of '1' bits present in the binary representation of the given integer n. 5.🧠 Key idea: Approach 1: Keep dividing n by 2 and count if the remainder is 1. This counts the number of 1's in binary form by repeatedly checking and incrementing a counter. A simple while-loop approach that efficiently solves the problem for any positive integer n.image.jpg #100DaysOfCode #LeetCode #CodingChallenge #BitManipulation #DataStructures #Algorithms #Java #Programming #Tech #CodeNewbie #InterviewPrep #LeetCodeEasy #ProblemSolving #LearnToCode #Developer
To view or add a comment, sign in
-
-
NeetCode 27 | LeetCode #74 | Search in a 2D Matrix Flattened the 2D matrix logic into a binary search approach for efficient lookup. Treating rows and columns as a single sorted array — achieving O(log(m × n)) time complexity. A neat combination of logic and spatial understanding 🧩 #NeetCode #LeetCode #Java #DSA #BinarySearch #Algorithms #ProblemSolving #CodingJourney
To view or add a comment, sign in
-
206 – Reverse Linked List Mastered linked list reversal using the iterative approach! This fundamental algorithm is crucial for understanding pointer manipulation and linked list operations. 💡 Iterative Approach: Used three pointers (prev, curr, next) to reverse links in one pass through the list. The key is carefully updating pointers while traversing to avoid losing reference to remaining nodes. I also explored recursive solutions but focused on the iterative method for its O(1) space complexity and clear step-by-step pointer manipulation. #LeetCode #Java #LinkedList #DataStructures #Algorithms #Iterative #Pointers #ProblemSolving #Coding #Tech #SoftwareEngineering #DailyCoding
To view or add a comment, sign in
-
-
NeetCode 33 | LeetCode #141 | Linked List Cycle Detection Used two pointers moving at different speeds: If they meet → cycle exists If the fast pointer reaches null → no cycle Efficient and elegant solution for a common linked list problem. #LeetCode #NeetCode #Java #Algorithms #DataStructures #Optimization #Coding
To view or add a comment, sign in
-
🚀 Day 62/100 of #100DaysOfLeetCode Today’s challenge was “Happy Number” (LeetCode Problem 202). The task was to determine whether a given number is a Happy Number — meaning that by repeatedly replacing the number with the sum of the squares of its digits, the process eventually reaches 1. 💡 Key Takeaways: Strengthened understanding of pointer movement logic. Improved implementation skills using mathematical and logical thinking in Java. #100DaysOfCode #LeetCode #Java #CodingChallenge #ProblemSolving #DataStructures #Algorithms
To view or add a comment, sign in
-
-
#100DaysOfCode – Day 74 Count and Say Problem: Given an integer n, return the n-th term of the “Count and Say” sequence a fascinating pattern where each term describes the previous one. Example: Input: n = 4 Output: "1211" My Approach: Used recursion to generate the previous term. Applied run-length encoding logic counted consecutive digits and built the next term using a StringBuilder. Optimized for clean, readable iteration with O(N²) complexity (due to string building). Understanding recursive string construction deepens how we visualize “generation-based” sequences it’s not just about coding, it’s about seeing patterns grow. #100DaysOfCode #Java #LeetCode #ProblemSolving #Recursion #StringManipulation #CodingJourney #TechWithPurpose #takeUforward
To view or add a comment, sign in
-
-
#Day14 94 – Binary Tree Inorder Traversal 💡 Approach: Used recursive depth-first search to traverse left subtree, process current node, then traverse right subtree. This follows the natural inorder sequence where nodes are visited in ascending order for BSTs. #LeetCode #Java #BinaryTree #DataStructures #Algorithms #Recursion #DFS #ProblemSolving #Coding #Tech #SoftwareEngineering #DailyCoding
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