Hey Devs! π
Today, I deep-dived into Binary Search and explored some interesting problems using TypeScript. Here's what I worked on:
π What I Learned:
β
Binary Search in Depth β Understanding the intuition behind it
β
Floor & Ceil in a Sorted Array β Using Binary Search efficiently
β
Recursive Approach β Improved understanding of recursion while implementing
𧩠Floor & Ceil Problem:
β‘οΈ Floor: Largest element β€ target
β‘οΈ Ceil: Smallest element β₯ target
π₯ Key Takeaways:
β‘οΈ Binary Search makes floor & ceil problems efficient.
β‘οΈ Iterative & Recursive approaches both provide valuable insights.
β‘οΈ Understanding edge cases is crucial, like when the target is smaller/larger than all elements.
Iβm really enjoying this challenge so far! Next up, I plan to explore strivers DSA sheet and searching in rotated sorted arrays.
π‘ What are your thoughts on my implementation? Any improvements or alternative approaches? Letβs discuss!
Top comments (0)