Блог пользователя JustAkash21

Автор JustAkash21, 9 часов назад, По-английски

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?

Полный текст и комментарии »

  • Проголосовать: нравится
  • +17
  • Проголосовать: не нравится