Amazon.com Interview Question
1,572 Interview Reviews |
Back to all Amazon.com Interview Questions & Reviews
Interview questions and reviews posted anonymously by interview candidates
Interview Question for Software Engineer at Amazon.com:
Give pseudocode over phone and code on a shared screen how to scramble an array of integers in random order. Then optimize it for better performance.
Helpful Question?
Yes |
No
Inappropriate?
Answers & Comments (2)
Helpful Answer?
Yes |
No
Inappropriate?
To comment on this
question,
Sign In with Facebook or
Sign Up



0 of 0 people found this helpful
by Rishi:
i = 0;
for (i = 0; i < num; i++)
arraycard[i] = i;
Random randomInt = new Random();
int t;
for (j = 0; j < num; j++) {
int rand1 = j + randomInt.nextInt(num - j);
t = arraycard[j];
arraycard[j] = arraycard[rand1];
arraycard[rand1] = t;
}