Hul Hub interview question

Like matching patterns question based on stack queue