Find top-k distinct elements | Google Interview Question