Bloomberg L.P. Interview Question: 1. How will you find the max ... | Glassdoor

Interview Question

Financial Software Developer Intern Interview(Student Candidate)

1. How will you find the max and second max of an array of

  n elements? How will you find the largest k elements? 2. How will you properly shuffle a deck of cards?

Interview Answer

1 Answer


1. First part is easy. Have two max ints. if currentInt > max1, max2 = max1, max1 = currentInt. When you get k, you need to check each max value in array of size k. You could also sort in O(n log n) and get last k elements.

2. To shuffle, you can pick a random position (after current pos) and swap with current. There are many more ways.

Anonymous on Oct 11, 2013

Add Answers or Comments

To comment on this, Sign In or Sign Up.