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

Автор B0JACK, 4 года назад, По-английски

Hello all, I'm currently struggling in this question, and cannot seem to find a direction in which I should approach this question. This question was asked in an online assessment on hackerrank yesterday. Any help or direction in which I should tackle this will be really greatful! Thanks.

Edit 1. I've mentioned my thought process as of yet in the comments.

Edit 2. Also, before downvoting, can you please mention the reason, so that I can learn what part of this blog I posted is causing the trouble, thanks.

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

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

What I have thought regarding this question till now is that first I will seperate the odd indices and even indices into seperate arrays.

Then if I'm able to find those indices from where no candidate is transferred to the left or right, and those indices where no candidate is taken in, I might be able to divide the transfers into subarrays. And the next thing I would want to find will be to find the minimum operations required for the transfer in those particular subarrays. Finding this is the difficult part in my opinion.

I think there might be a better way to approach this. Would really appreciate any help!