Lenovo Interview Question

Technical Coding Questions: 1. Reverse a string in place along with the complexities 2. Given an array with numbers arranged in increasing order, find the position of the given query number. Draw the recursion tree if done by binary search.

Interview Answer

Anonymous

Jul 7, 2024

1. Two pointer approach - start from first and last characters simultaneously and keep swapping the characters until these pointer cross each other. 2. Simply apply Binary Search