B0JACK's blog

By B0JACK, 3 years ago, In English

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.

  • Vote: I like it
  • -31
  • Vote: I do not like it

| Write comment?
»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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!