3 подписчика
Leetcode 1920. Build Array from Permutation
После долгих праздничных выходных — приходится «разогревать» голову задачками с высоким Acceptance. И даже они — не сразу заходят. Со скрипом.
class Solution {
public static int[] buildArray(int[] nums) {
int[] ans = new int[nums.length];
for (int i = 0; i
Given a zero-based permutation nums (0-indexed), build an array ans of the same length where ans[i] = nums[nums[i]] for each 0 <= i < nums.length and return it.
A zero-based permutation nums is an array of distinct integers from 0 to nums.length - 1 (inclusive).
https://leetcode.com/problems/build-array-from-permutation/description/
#algorithms #array #java #leetcode
--- Ссылка на запись ---
Около минуты
27 февраля 2023