Condition to check if the element is present in the stack
if ( freq . ContainsKey ( poppedEle ) ) freq [ poppedEle ] = freq [ poppedEle ] - 1 ; } if ( freq . Count == 0 ) return false ; return true ; }