yandex.ru interview
Questions4
Given an array of numbers a₁, a₂, …, aₙ. Find a monotonic subarray (that is, strictly decreasing or strictly increasing) of maximum length and return the pair of indices marking its beginning and end. Examples: [2, 7, 5, 4, 4, 3] → {1, 3} [1, 1] → {1, 1} // or {0, 0}
You start the loop at one and immediately access the second element (`arr[i-1]`). What happens if the array contains only one element? Will this code panic?
2 more questions from this interview
A subscription opens every question, and Copilot suggests answers live during your yandex.ru interview.
Sign in to unlockSummarized questions based on candidates' accounts. These materials do not represent the official position of the companies and do not disclose internal processes. If you believe a publication violates your rights — contact us.