All Downloads are FREE. Search and download functionalities are using the official Maven repository.

g1901_2000.s1920_build_array_from_permutation.Solution.kt Maven / Gradle / Ivy

There is a newer version: 1.30
Show newest version
package g1901_2000.s1920_build_array_from_permutation

// #Easy #Array #Simulation #2023_06_20_Time_252_ms_(81.25%)_Space_39.3_MB_(70.83%)

class Solution {
    fun buildArray(nums: IntArray): IntArray {
        val ans = IntArray(nums.size)
        for (i in nums.indices) {
            ans[i] = nums[nums[i]]
        }
        return ans
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy