|
3 | 3 | importjava.util.ArrayList; |
4 | 4 | importjava.util.List; |
5 | 5 |
|
6 | | -/** |
7 | | - * 1313. Decompress Run-Length Encoded List |
8 | | - * |
9 | | - * We are given a list nums of integers representing a list compressed with run-length encoding. |
10 | | - * Consider each adjacent pair of elements [a, b] = [nums[2*i], nums[2*i+1]] (with i >= 0). |
11 | | - * For each such pair, there are a elements with value b in the decompressed list. |
12 | | - * |
13 | | - * Return the decompressed list. |
14 | | - * |
15 | | - * Example 1: |
16 | | - * Input: nums = [1,2,3,4] |
17 | | - * Output: [2,4,4,4] |
18 | | - * Explanation: The first pair [1,2] means we have freq = 1 and val = 2 so we generate the array [2]. |
19 | | - * The second pair [3,4] means we have freq = 3 and val = 4 so we generate [4,4,4]. |
20 | | - * At the end the concatenation [2] + [4,4,4,4] is [2,4,4,4]. |
21 | | - * |
22 | | - * Constraints: |
23 | | - * 2 <= nums.length <= 100 |
24 | | - * nums.length % 2 == 0 |
25 | | - * 1 <= nums[i] <= 100 |
26 | | - * */ |
27 | 6 | publicclass_1313 { |
28 | 7 | publicstaticclassSolution1 { |
29 | 8 | publicint[]decompressRLElist(int[]nums) { |
|