Juniper | SDE | 4 December

Juniper · Question · Posted Apr 2020

You are given an array A of size n which can have duplicate elements. You can remove at max 'm' elements from this array and the resulting array should have minimum possible distinct elements. A = [1 2 1 1 2 3] and m=2 One can remove '2' and '3' and resulting array will have only 2 ('1' and '2') distinct elements.

The full answer & interview discussion are available to premium members.

Log in Create a free account