Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ Each problem follows this structure:

## Solutions

📊 **Statistics**: 55 problems solved (migrated to new structure)
📊 **Statistics**: 56 problems solved (migrated to new structure)

| Difficulty | Count |
|------------|-------|
| Easy | 39 |
| Easy | 40 |
| Medium | 15 |
| Hard | 1 |

Expand Down
3 changes: 2 additions & 1 deletion docs/EASY.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Easy Problems

Total: 39 problems solved
Total: 40 problems solved

## Solutions

Expand Down Expand Up @@ -35,6 +35,7 @@ Total: 39 problems solved
| 1684 | [Count the Number of Consistent Strings](https://leetcode.com/problems/count-the-number-of-consistent-strings/) | [CountTheNumberOfConsistentStrings1684.java](../src/main/java/com/leetcode/easy/CountTheNumberOfConsistentStrings1684.java) | [CountTheNumberOfConsistentStrings1684Test.java](../src/test/java/com/leetcode/easy/CountTheNumberOfConsistentStrings1684Test.java) |
| 1773 | [Count Items Matching a Rule](https://leetcode.com/problems/count-items-matching-a-rule/) | [CountItemsMatchingARule1773.java](../src/main/java/com/leetcode/easy/CountItemsMatchingARule1773.java) | [CountItemsMatchingARule1773Test.java](../src/test/java/com/leetcode/easy/CountItemsMatchingARule1773Test.java) |
| 1816 | [Truncate Sentence](https://leetcode.com/problems/truncate-sentence/) | [TruncateSentence1816.java](../src/main/java/com/leetcode/easy/TruncateSentence1816.java) | [TruncateSentence1816Test.java](../src/test/java/com/leetcode/easy/TruncateSentence1816Test.java) |
| 1929 | [Concatenation of Array](https://leetcode.com/problems/concatenation-of-array/) | [ConcatenationOfArray1929.java](../src/main/java/com/leetcode/easy/ConcatenationOfArray1929.java) | [ConcatenationOfArray1929Test.java](../src/test/java/com/leetcode/easy/ConcatenationOfArray1929Test.java) |
| 1941 | [Check if All Characters Have Equal Number of Occurrences](https://leetcode.com/problems/check-if-all-characters-have-equal-number-of-occurrences/) | [CheckIfAllCharactersHaveEqualNumberOfOccurrences1941.java](../src/main/java/com/leetcode/easy/CheckIfAllCharactersHaveEqualNumberOfOccurrences1941.java) | [CheckIfAllCharactersHaveEqualNumberOfOccurrences1941Test.java](../src/test/java/com/leetcode/easy/CheckIfAllCharactersHaveEqualNumberOfOccurrences1941Test.java) |
| 2011 | [Final Value of Variable After Performing Operations](https://leetcode.com/problems/final-value-of-variable-after-performing-operations/) | [FinalValueOfVariableAfterPerformingOperations2011.java](../src/main/java/com/leetcode/easy/FinalValueOfVariableAfterPerformingOperations2011.java) | [FinalValueOfVariableAfterPerformingOperations2011Test.java](../src/test/java/com/leetcode/easy/FinalValueOfVariableAfterPerformingOperations2011Test.java) |
| 2032 | [Two Out of Three](https://leetcode.com/problems/two-out-of-three/) | [TwoOutOfThree2032.java](../src/main/java/com/leetcode/easy/TwoOutOfThree2032.java) | [TwoOutOfThree2032Test.java](../src/test/java/com/leetcode/easy/TwoOutOfThree2032Test.java) |
Expand Down
17 changes: 0 additions & 17 deletions src/ConcatenationOfArray1929.java

This file was deleted.

27 changes: 27 additions & 0 deletions src/main/java/com/leetcode/easy/ConcatenationOfArray1929.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Tags: Array
package com.leetcode.easy;

/**
* <p><b>Time Complexity:</b> O(n)
* <ul>
* <li>Single loop through 2n elements, where n = nums.length</li>
* <li>Each iteration performs O(1) operations (modulo and array access)</li>
* <li>Total: O(2n) = O(n)</li>
* </ul>
*
* <p><b>Space Complexity:</b> O(n)
* <ul>
* <li>Result array of size 2n is allocated</li>
* <li>No additional significant space used</li>
* <li>Total: O(2n) = O(n)</li>
* </ul>
*/
public class ConcatenationOfArray1929 {
public int[] getConcatenation(int[] nums) {
int[] ans = new int[nums.length * 2];
for (int i = 0; i < nums.length * 2; i++) {
ans[i] = nums[i % nums.length];
}
return ans;
}
}
25 changes: 25 additions & 0 deletions src/test/java/com/leetcode/easy/ConcatenationOfArray1929Test.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.leetcode.easy;

import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;

public class ConcatenationOfArray1929Test {

@Test
void testExample1() {
ConcatenationOfArray1929 solution = new ConcatenationOfArray1929();
int[] nums = {1, 2, 1};
int[] expected = {1, 2, 1, 1, 2, 1};
int[] result = solution.getConcatenation(nums);
assertArrayEquals(expected, result);
}

@Test
void testExample2() {
ConcatenationOfArray1929 solution = new ConcatenationOfArray1929();
int[] nums = {1, 3, 2, 1};
int[] expected = {1, 3, 2, 1, 1, 3, 2, 1};
int[] result = solution.getConcatenation(nums);
assertArrayEquals(expected, result);
}
}
Loading