ZS Associates Interview Question

Hell or Heaven Puzzle