Skip to content

Commit 695b635

Browse files
committed
Feat: adds Shawn Dunsmore Lesson 11 SpotlessApply.
1 parent 0bc66b6 commit 695b635

File tree

1 file changed

+19
-20
lines changed
  • lesson_11/arrays_java/arrays_app/src/main/java/com/codedifferently/lesson11

1 file changed

+19
-20
lines changed
Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
package com.codedifferently.lesson11;
2+
23
import java.util.ArrayList;
34
import java.util.List;
45

@@ -9,32 +10,30 @@ public class Lesson11 {
910
* https://leetcode.com/problems/concatenation-of-array
1011
*/
1112
public int[] getConcatenation(int[] nums) {
12-
int n = nums.length;
13-
int[] ans = new int[2 * n];
14-
15-
16-
for (int i = 0; i < n; i++) {
17-
ans[i] = nums[i];
18-
ans[i + n] = nums[i];
19-
}
20-
21-
return ans;
22-
}
13+
int n = nums.length;
14+
int[] ans = new int[2 * n];
15+
16+
for (int i = 0; i < n; i++) {
17+
ans[i] = nums[i];
18+
ans[i + n] = nums[i];
19+
}
2320

21+
return ans;
22+
}
2423

2524
/**
2625
* Provide the solution to LeetCode 2942 here:
2726
* https://leetcode.com/problems/find-words-containing-character/
2827
*/
29-
public List<Integer> findWordsContaining(String[] words, char x) {
30-
List<Integer> indices = new ArrayList<>();
31-
32-
for (int i = 0; i < words.length; i++) {
33-
if (words[i].indexOf(x) != -1) {
34-
indices.add(i);
35-
}
36-
}
28+
public List<Integer> findWordsContaining(String[] words, char x) {
29+
List<Integer> indices = new ArrayList<>();
3730

38-
return indices;
31+
for (int i = 0; i < words.length; i++) {
32+
if (words[i].indexOf(x) != -1) {
33+
indices.add(i);
34+
}
3935
}
36+
37+
return indices;
38+
}
4039
}

0 commit comments

Comments
 (0)