Meta interview question

LC M Questions but cant use window function to solve.