🔹 Linear Search in Java
🔹 Binary Search in Java (Iterative)
✅ 2. LeetCode Problems
🔸 Search Insert Position
Problem: Return the index if the target is found. If not, return the index where it would be inserted.
🔸 First Bad Version
Assume
isBadVersion(version)
API exists.
🌱 3. Explore: Lower Bound & Upper Bound
These are binary search variants often used in competitive programming.
🔸 Lower Bound (First element ≥ target)
🔸 Upper Bound (First element > target)
You can test both with:
Comments
Post a Comment