LinkedIn Interview Question
141 Interview Reviews |
Back to all LinkedIn Interview Questions & Reviews
Interview questions and reviews posted anonymously by interview candidates
Interview Question for Search Engineer, Front End at LinkedIn:
randomize an array.
| Tags: | algorithm See more , See less 8 |
See more for this LinkedIn Search Engineer, Front End Interview
Helpful Question?
Yes |
No
Inappropriate?
Answers & Comments (3)
0 of 1 people found this helpful
public static void randomize(int[] a) {
int tmp, index;
for (int i = 0; i < a.length; i++){
index = (int) (Math.random() * (a.length - i)) + i;
tmp= a[i];
a[i] = a[index];
a[index] = tmp;
}
}
Helpful Answer?
Yes |
No
Inappropriate?
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 Interview Candidate: