Microsoft interview question

Basic of java. complex algo