This wording is throwing me off

Hello. I am trying to solve a Leetcode problem. I am unable to “break the problem down into smaller problems” because I can’t even “translate” what the problem is asking.

“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.”

What does " for each 0 <= i < nums.length" even mean? That wording really throws me off. It’s like my brain can’t process what it is asking lol. This is WAYYYYYYY different from Codewars, where they leave out all of the fluff and just tell you what the problem is lol.

There is written below

A zero-based permutation nums is an array of distinct integers from 0 to nums.length - 1 (inclusive ).

Thank you for your response. So what does that tell you? I have a learning disability so bear with me lol

You get an array with numbers from 0 to nums.length - 1 but shuffled

Oh ok. This threw me off

ans of the same length where ans[i] = nums[nums[i]] for each 0 <= i < nums.length

It is telling you what to put inside of a new array. It’s a pretty bare-bones description.

Not to me though ): for each 0 <= i < nums.length. 0 is less than or equal to i and i is less than or equal to nums.length. threw me off. learning disability. sorry lol

They are writing most of the pesudocode of the algorithm for you.

usually, when I look at the examples they have of the arrays, I know what they are asking. but when reading what’s above it like what I sent above, it throws me off lol.

this means each item in the array (each possible value of i)

1 Like

It takes time to get used to understanding technical descriptions.

1 Like

lol i think that’s why I can do a lot of problems on codewars. they don’t word them the way they do on leetcode lol. thank you all for your help!!!