Deutsche Bank Interview Question

A question about stack and queue and a leetcode difficult question about checking rate