본문 바로가기

Coding Test/리트코드

[리트코드/자바] 1920. Build Array from Permutation

class Solution {
    public int[] buildArray(int[] nums) {
        int[] result = new int[nums.length];

        for (int n : nums) {
            result[n] = nums[nums[n]];
        }

        return result;
    }
}