HackerRank Java Dequeue problem solution - TheCScience