Google interview question

complete djistraka algorithm in 3 different ways