Skip to main content
1 of 7
Graham
  • 6.8k
  • 1
  • 15
  • 11

#APL+WIN, 33 bytes

Prompts for vector of integers max first:

+/,((1+⌈⌈/2⍟v)⍴2)⊤v←(↑v)+0,⍳-/v←⎕
Graham
  • 6.8k
  • 1
  • 15
  • 11