i have the same algorithm as was shown in the editorial but still my code is not passing two test cases
Please help me with my code
hello please help me
can you please tell me why my code is failing
i think the formula shown in editorial is incorrect… it will give value 10 when no of distinct elements are 4
formula is correct , you should use map to keep track of elements