Microsoft Interview Question for Software Engineer Interns
- 0of 0 votes
You are given an array of positive and negative integers. If a number n at an index is positive, then move forward n steps. Conversely, if it's negative, move backward n steps. Determine if there is a loop in this array.- email@example.com October 29, 2016 in United States
For example, given the array [2, -1, 1, 2, 2], index 0 maps to index 2, 1 maps to 0, 2 maps to 3, and so on. There is a loop in this array because 0 maps to 2, 2 maps to 3, and 3 maps to 0 (use the modulo operator).
| Report Duplicate | Flag | PURGE
Microsoft Software Engineer Intern Arrays
Open Chat in New Window