Function to check if all array elements is present in the stack
static bool checkArrInStack ( Stack < int > s , int [ ] arr , int n ) { Dictionary < int , int > freq = new Dictionary < int , int > ( ) ;