HashedIn by Deloitte Interview Question

Asked puzzles to be solved verbally them write program for it and them optimize the solution you had given!