id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

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)

public int[] inversePermutation(int[] arr){ }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 200 Post-solution available

Copyright Nick Parlante 2017 - privacy