Salesforce| Virtual Interview 1 | USA | Search in Array with unknown length
Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2021-11-18Added By Anonymous
Source: Link
Company: Salesforce
Role: unknown
Stage: Virtual Interview
Location: USA
Year: unknown
Original Post:
I got this question in one of my virtual rounds, where I am given a sorted array, and I have to find a target in log(n) time complexity. The only caveat is, I don't have access to the length of that array. I cannot use arr.length. Its similar to https://leetcode.com/problems/search-in-a-sorted-array-of-unknown-size/, but here the method is taking ArrayReader, but in this question we are given the complete array. Any idea how to establish right boundary without overflowing?
Role: unknown
Stage: Virtual Interview
Location: USA
Year: unknown
Original Post:
I got this question in one of my virtual rounds, where I am given a sorted array, and I have to find a target in log(n) time complexity. The only caveat is, I don't have access to the length of that array. I cannot use arr.length. Its similar to https://leetcode.com/problems/search-in-a-sorted-array-of-unknown-size/, but here the method is taking ArrayReader, but in this question we are given the complete array. Any idea how to establish right boundary without overflowing?