Skip to content

Instantly share code, notes, and snippets.

View nerdyalgorithm's full-sized avatar
🎯
Focusing

Angelic nerdyalgorithm

🎯
Focusing
View GitHub Profile
@nerdyalgorithm
nerdyalgorithm / LeetCode 1920.md
Last active August 5, 2025 19:20
LeetCode 1920 — Build Array from Permutation

QUESTION

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.

APPROACH

The problem says to return an array where ans[i] = nums[nums[i]].