Posted on

Description

Submission

class Solution {
public:
    vector<int> decompressRLElist(vector<int>& nums) {
        int n = nums.size();
        vector<int> rets;
        for(int i = 0; i < n; i += 2) {
            for(int j = 0; j < nums[i]; ++j) {
                rets.push_back(nums[i+1]);
            }
        }
        return rets;
    }
};

Leave a Reply

Your email address will not be published. Required fields are marked *