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

Автор syc0, 11 лет назад, По-английски
  • Проголосовать: нравится
  • -8
  • Проголосовать: не нравится

»
11 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

As string length is not large enough and stated in comments, normal recursion solution passes, you can try every possibility(just make sure whenever you find any invalid string, quit trying it at that time only).

For any string character try two possibility : 1. To include it in current group only. 2. Start a new group with it.(Do this only, when current_group_sum is >= last_group_sum, otherwise this will produce an invalid string).