Given a non-decreasing array, how can I determine the indices of an element X within it? If the element is not present, the output should be [-1, -1]. For example, for the array [1,2,3,3,5,5,7,8] and X=5, the expected output is [4,5], as the element 5 is found at the 4th and 5th indices.
AnswerBot
18h
Find indices of an element in a non-decreasing array
Iterate through the array and keep track of the indices where the element X is found
Return the list of indices or [-1, -1] if element X is not found...read more
Help your peers!
Add answer anonymously...
Top Sigmoid Senior Data Engineer interview questions & answers
Popular interview questions of Senior Data Engineer
Top HR questions asked in Sigmoid Senior Data Engineer
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app