Skip to content

Commit

Permalink
feat: Add solution for concatenation-of-array problem
Browse files Browse the repository at this point in the history
  • Loading branch information
pragusga25 committed Jul 13, 2024
1 parent 3eae736 commit 673066c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions easy/concatenation-of-array.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Problem: https://leetcode.com/problems/concatenation-of-array/
// Doc: https://leetcode.com/problems/concatenation-of-array/solutions/5472607/double-your-array-fun-with-concatenation/
const getConcatenation = (nums: number[]): number[] => [...nums, ...nums];

describe('Concatenation of Array', () => {
it('should return the concatenated array', () => {
expect(getConcatenation([1])).toEqual([1, 1]);
expect(getConcatenation([1, 1])).toEqual([1, 1, 1, 1]);
expect(getConcatenation([1, 2, 1])).toEqual([1, 2, 1, 1, 2, 1]);
expect(getConcatenation([1, 3, 2, 1])).toEqual([1, 3, 2, 1, 1, 3, 2, 1]);
});
});

0 comments on commit 673066c

Please sign in to comment.