Citadel Interview Question

leetcode medium/hard - some behavioral