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>& nums) { |
| 2 | |
| 3 | vector<int> ends; |
| 4 | |
| 5 | for (int x : nums) { |
| 6 | |
| 7 | auto slot = lower_bound(ends.begin(), ends.end(), x); |
| 8 | |
| 9 | if (slot == ends.end()) { |
| 10 | ends.push_back(x); |
| 11 | } else { |
| 12 | *slot = x; |
| 13 | } |
| 14 | } |
| 15 | |
| 16 | return ends.size(); |
| 17 | } |
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.