DSA GRIND #4
DSA GRIND #4 BY ASHUR BAROUTTA This week we kept up with the trend of solving 2 problems a week. The first problem asked us to concatenate two arrays. Stating "Given an integer array nums of length N, create an array ans of length 2N where ans[i] == nums[i] and ans[i+n] == nums[i]". This took more thought than actual coding as the solution turned out to be far simpler than imagined. I settled for making a new array with twice the size of nums length, then I initialized a variable j = 0. After that I made a for loop and within that loop I set a condition to check if i was less than the length of the original array as if it was I knew I could just make the indexes of the new array equal to the same index as nums array. After that, we set newarray[i] equal to nums[j] as j is incrementing from 0 and at the point where this started we would be passed all the first recorded indexes. A merger like this is probably useful when wanting to join two different specific arrays into...