← TCS questions

Sorting and Searching

Filed under TCS · Also reported at Asite Solutions Pvt. Ltd.

Given an array of integers nums sorted in ascending order and an integer target, write a function to search target in nums. Return its index if found; otherwise, return -1.

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related TCS questions

Collected from public candidate posts and coding forums. Updated Nov 2026.