Created
August 19, 2020 16:51
-
-
Save bparanj/7b7eb6354c2361e396ae6a0f066628b5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create_target_array(nums, index) | |
result = [] | |
i = 0 | |
while result.size < nums.size | |
result.insert(index[i], nums[i]) | |
i += 1 | |
end | |
result | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Refactored code: