Type an input and write what you think is the output . Each problem is converted to Web Assembly, so any possible input will show the corresponding output. Only correct predictions count.
Locked until you have predicted 3 outputs correctly.
| 1 | int solution(const vector<int>& money) { |
| 2 | |
| 3 | int skip = 0; |
| 4 | int take = 0; |
| 5 | |
| 6 | for (int x : money) { |
| 7 | |
| 8 | int next = max(take, skip + x); |
| 9 | |
| 10 | skip = take; |
| 11 | take = next; |
| 12 | } |
| 13 | |
| 14 | return take; |
| 15 | } |
Names have been stripped. The signature is the only clue you get for free. Compiled as C++20 with the standard headers and using namespace std; already in scope.