Amazon Interview Question

Two questions were asked in the interview based on binary tree and sliding window problem