3 ms·
Technically the rules never state that when splitting an integer you have to put the new numbers in place of the old one, so... [3, 2, 1] [0, 2, 1, 3] [2, 1,
by thih9 3y ago
Technically the rules never state that when splitting an integer you have to put the new numbers in place of the old one, so...
[3, 2, 1]
[0, 2, 1, 3]
[2, 1, 3]
[0, 1, 2, 3]
[1, 2, 3]
I.e.: Split 3 into 3+0. Combine 0+2. Split 1 into 1+0. Combine 0+3 because rules don’t prohibit that either.
- Sharlin 3y agoYeah, the problem is slightly underspecified, though it’s pretty obvious that you’re not allowed to do swaps as that obviously makes the problem trivial.
- thih9 3y agoNot trivial - I do not see how to solve [3, 2, 1] without this kind of swapping. Perhaps we need to clarify the rules for a starting point first.
- Etherlord87 3y agoYou're supposed to split an integer into two *smaller* integers. 3 is not smaller than 3, so you can't split 3 into 3+0.
- thih9 3y agoOh, good spot. Yeah, no luck then.