Deepression's blog

By Deepression, history, 4 hours ago, In English

You are given an array of size N and must construct a deque by pushing each element one by one, either to the front or the back. You can push a total of K elements to the back and M elements to the front, with the constraint that M + K = N . Your goal is to determine the maximum number of index pairs (i, j) such that 2 *{deque}[i] > {deque}[j] and i < j. Constraints on N is 1e6.

Full text and comments »

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