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

Автор Mexicano, история, 11 месяцев назад, По-английски

I found this problem here. basics — bitwise operations, and this is the link of it.

Any accepted solution depends on a greedy approach that walking from the MSB, but it's clear that it doesn't work on very simple tests like that

3 4

1 1 4

The greedy approach makes X = 4 which give a result = 10, the real solution must make X = 2, so the result = 12.

That means there's a bug in this problem, so any suggestions to solve it with a trusted approach?

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

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

Interested!