|
|
back to boardsol.push_back(ceil((double)n/2)) (sol is vector in c++) If you solved it using such code, please explain why it works. Basically, it's a greedy algorithm: the maximum length you can fold is CURRENT_LENGTH / 2. So, you just fold it in half until it's of length 1. |
|
|