J.P. Morgan interview question

Java or Python program was given, I had to choose one and debug and optimize it.