Virtu Financial Interview Question

one question is similar to applecount question from Leetcode