Hello Programmers, In this post, you will know how to solve the Java Dequeue HackerRank Solution. This problem is a part of the HackerRank Java Programming Series.Java Dequeue HackerRank SolutionsOne more thing to add, don’t directly look for the solutions, first try to solve the problems of Hackerrank by yourself. If you find any difficulty after trying several times, then you can look for solutions.Java Dequeue HackerRank SolutionProblemIn computer science, a double-ended queue (dequeue, often abbreviated to deque, pronounced deck) is an abstract data type that generalizes a queue, for which elements can be added to or removed from either the front (head) or back (tail).Deque interfaces can be implemented using various types of collections such as LinkedList or ArrayDeque classes. For example, deque can be declared as:Deque deque = new LinkedList<>(); or Deque deque = new ArrayDeque<>(); You can find more details about Deque here.In this problem, you are given integers. You need to find the maximum number of unique integers among all the possible contiguous subarrays of size .Note: Time limit is second for this problem.Input FormatThe first line of input contains two integers and : representing the total number of integers and the size of the subarray, respectively. The next line contains space separated integers.ConstraintsThe numbers in the array will range between .Output FormatPrint the maximum number of unique integers among all possible contiguous subarrays of size .Sample Input6 3 5 3 5 2 3 2 Sample Output3Java Dequeue HackerRank Solutionsimport java.util.*; public class test { public static void main(String[] args) { Scanner in = new Scanner(System.in); Deque deque = new ArrayDeque<>(); HashSet<Integer> set = new HashSet<>(); int n = in.nextInt(); int m = in.nextInt(); int max = Integer.MIN_VALUE; for (int i = 0; i < n; i++) { int input = in.nextInt(); deque.add(input); set.add(input); if (deque.size() == m) { if (set.size() > max) max = set.size(); int first = (int) deque.remove(); if (!deque.contains(first)) set.remove(first); } } System.out.println(max); } }Disclaimer: The above Problem (Java Dequeue) is generated by Hackerrank but the Solution is Provided by BrokenProgrammers. This tutorial is only for Educational and Learning purposes.Next: Java BitSet HackerRank Solution Post navigationJava Comparator HackerRank Solution Java BitSet HackerRank Solution