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

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

Given an array, you can select any subarray of length 3, say $$$[a, b, c]$$$. Then, if $$$a + c \gt b$$$, you can delete this triplet, and replace it with $$$(a + c - b)$$$.

Can you achieve an array of length 1 by doing these operations optimally? Then, solve a harder version: How many subarrays can be trimmed to length 1 after doing these operations?

I created a video talking about the ideas and intuition used in this problem

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