rhezo's blog

By rhezo, history, 8 years ago, In English

How is the test case given in the image for this problem correct? The only possible sets are {9,10,11} or {9,10,12}. None of them have exactly n/2 terms even or odd. The test case is : {4, 321, {6, 12, 2, 3, 9, 8, 10, 5}, {0, 3, 0, 0, 1, 0, 2, 0}}. Please help!

  • Vote: I like it
  • +5
  • Vote: I do not like it

»
8 years ago, # |
  Vote: I like it +3 Vote: I do not like it

n=4 so your set should contain 4 elements instead of 3. It can be {9,10,11,100}.

  • »
    »
    8 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Thanks, didn't think hard enough, there is no condition given for numbers [maximum in upTo array+1, b]. Thanks!