JustAkash21's blog

By JustAkash21, 4 months ago, In English

Let's Discuss a question I recently came across, it seems easy but constraints make it too hard (At least for me).

Given an array A of size N, find the maximum size of subarray in which frequency of all the elements are same.

1 <= N <= 3 x 10^5

1 <= A[i] <= 10^9

O(N^2) Approach I guess will be to maintain 2 maps and consider all subarray.

Can be do it better than O(N^2)?

What will be CF difficulty of this question with this constraints?

Full text and comments »

  • Vote: I like it
  • +18
  • Vote: I do not like it