Skip to content

Ready for LeetCode

Read · 1 of 3

LeetCode skips main and cin

On LeetCode you don't read input or print. You fill in a function inside a class, and LeetCode calls it with the input and checks what you return.

public: lets LeetCode call the function. vector<int>& nums is the input, passed by reference (Module 8).

1class Solution {
2public:
3 int maxProfit(vector<int>& prices) {
4 // your code here
5 }
6};