calmdown_69's blog

By calmdown_69, history, 4 years ago, In English

Hello everyone.

Reference: here

problem statement:

An array is good if all subarrays have atleast 1 element in them whose frequency is 1.

Good : 1,2,1
Good: 1,2,5,2,4,3,4
Bad: 1,2,3,1,2,3

O(N^2) solution is easy but can anyone share a better approach for this question.
Thank you.

Full text and comments »

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