Camerinfolks interview question

which algorithm would you choose for this task?