Skip to content

Commit c4e96a5

Browse files
add 1389
1 parent 0773f9c commit c4e96a5

File tree

1 file changed

+0
-43
lines changed

1 file changed

+0
-43
lines changed

src/main/java/com/fishercoder/solutions/_1389.java

-43
Original file line numberDiff line numberDiff line change
@@ -3,49 +3,6 @@
33
import java.util.ArrayList;
44
import java.util.List;
55

6-
/**
7-
* 1389. Create Target Array in the Given Order
8-
*
9-
* Given two arrays of integers nums and index. Your task is to create target array under the following rules:
10-
* Initially target array is empty.
11-
* From left to right read nums[i] and index[i], insert at index index[i] the value nums[i] in target array.
12-
* Repeat the previous step until there are no elements to read in nums and index.
13-
* Return the target array.
14-
*
15-
* It is guaranteed that the insertion operations will be valid.
16-
*
17-
* Example 1:
18-
* Input: nums = [0,1,2,3,4], index = [0,1,2,2,1]
19-
* Output: [0,4,1,3,2]
20-
* Explanation:
21-
* nums index target
22-
* 0 0 [0]
23-
* 1 1 [0,1]
24-
* 2 2 [0,1,2]
25-
* 3 2 [0,1,3,2]
26-
* 4 1 [0,4,1,3,2]
27-
*
28-
* Example 2:
29-
* Input: nums = [1,2,3,4,0], index = [0,1,2,3,0]
30-
* Output: [0,1,2,3,4]
31-
* Explanation:
32-
* nums index target
33-
* 1 0 [1]
34-
* 2 1 [1,2]
35-
* 3 2 [1,2,3]
36-
* 4 3 [1,2,3,4]
37-
* 0 0 [0,1,2,3,4]
38-
*
39-
* Example 3:
40-
* Input: nums = [1], index = [0]
41-
* Output: [1]
42-
*
43-
* Constraints:
44-
* 1 <= nums.length, index.length <= 100
45-
* nums.length == index.length
46-
* 0 <= nums[i] <= 100
47-
* 0 <= index[i] <= i
48-
* */
496
public class _1389 {
507
public static class Solution1 {
518
public int[] createTargetArray(int[] nums, int[] index) {

0 commit comments

Comments
 (0)