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 | bool solution(const vector<int>& nums) { |
| 2 | |
| 3 | int n = nums.size(); |
| 4 | int reach = 0; |
| 5 | |
| 6 | for (int i = 0; i < n; i++) { |
| 7 | |
| 8 | if (i > reach) { |
| 9 | return false; |
| 10 | } |
| 11 | |
| 12 | reach = max(reach, i + nums[i]); |
| 13 | } |
| 14 | |
| 15 | return true; |
| 16 | } |
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.