MCPcopy Create free account
hub / github.com/Tiwarishashwat/InterviewCodes / createTargetArray

Method createTargetArray

TargetArrayInGivenOrder.java:31–41  ·  view source on GitHub ↗
(int[] nums, int[] index)

Source from the content-addressed store, hash-verified

29// Way two
30
31 public int[] createTargetArray(int[] nums, int[] index) {
32 List<Integer> temp = new ArrayList<>();
33 int[] target = new int[nums.length];
34
35 for (int i = 0; i < nums.length; i++) temp.add(index[i], nums[i]);
36
37 for (int j = 0; j < temp.size(); j++) target[j] = temp.get(j);
38
39 return target;
40
41 }

Callers

nothing calls this directly

Calls 1

addMethod · 0.45

Tested by

no test coverage detected