Concatenation of array

May 6, 2023

array-and-hashmap

Problem URL: Concatenation of array

We can just merge the array with itself and return.

class Solution:
    def getConcatenation(self, nums: List[int]) -> List[int]:
        return nums + nums

Time complexity: O(n)
Space complexity: O(1)