Deutsche Bank interview question

case was challenging