As reported: Morgan Stanley backend engineer (Java + microservices, 2.4 years of experience), Nov 2025. Technical discussion: a multithreading scenario — find the highest number in a random matrix using threads; then CAS in Java and transaction management.
Write Java code that
- builds an
R × Cmatrix filled with random integers, and - finds its largest value using several threads.
The result must equal what a single-threaded scan returns. Be ready to explain how work is split, how the partial results are combined safely, and how many threads make sense.
Clarifications
R,Cand the number of threads are parameters.