Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution {
- public:
- int minNumberOperations(vector<int>& target) {
- int ans = target[0];
- for(int i=1; i<target.size(); i++)
- ans += max(0, target[i]-target[i-1]);
- return ans;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement