WNS-Vuram interview question

Stack Implementation Filtering array based on condition