result = [] for i, v in enumerate(nums): result.append(nums[v]) return result
@JJ-nv5hs6 ай бұрын
I was so close to this solution, i literally only forgot the [v] part. thank you for helping me with this.
@anonymoustv86042 жыл бұрын
Thanks for the explanation!
@jagggyjazz8010 Жыл бұрын
Bruh where is O(1) solution
@amroulouay6819 Жыл бұрын
class Solution: def build_array(nums): n = len(nums) for i, num in enumerate(nums): original_val = num % n new_val = nums[num] % n nums[i] = new_val * n + original_val for i in range(n): nums[i] //= n return nums
@abhisheksurela28812 жыл бұрын
I don't understand the question, or I would say the question is not clear