| about | help | code help+videos | done | prefs |
inversePermutation
You are given an array nums of length N containing a permutation of the numbers from 0 to N-1. Your task is to return a new array where the values of the original array become the indices of the new array, and the original indices become the new values. Formal Logic:If nums[i] = x, then result[x] = i. inversePermutation([1, 2, 0]) → [2, 0, 1] inversePermutation([0, 1, 2, 3]) → [0, 1, 2, 3] inversePermutation([3, 0, 2, 1]) → [1, 3, 2, 0] ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 200 Post-solution available
Copyright Nick Parlante 2017 - privacy