Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitadfb14d

Browse files
add 3069
1 parenta9b314e commitadfb14d

File tree

2 files changed

+32
-0
lines changed
  • paginated_contents/algorithms/4th_thousand
  • src/main/java/com/fishercoder/solutions/fourththousand

2 files changed

+32
-0
lines changed

‎paginated_contents/algorithms/4th_thousand/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
| 3083|[Existence of a Substring in a String and Its Reverse](https://leetcode.com/problems/existence-of-a-substring-in-a-string-and-its-reverse/)|[Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3083.java)|| Easy|
5555
| 3079|[Find the Sum of Encrypted Integers](https://leetcode.com/problems/find-the-sum-of-encrypted-integers/)|[Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3079.java)|| Easy|
5656
| 3074|[Apple Redistribution into Boxes](https://leetcode.com/problems/apple-redistribution-into-boxes/)|[Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3074.java)|| Easy|
57+
| 3069|[Distribute Elements Into Two Arrays I](https://leetcode.com/problems/distribute-elements-into-two-arrays-i/)|[Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3069.java)|| Easy|
5758
| 3062|[Winner of the Linked List Game](https://leetcode.com/problems/winner-of-the-linked-list-game/)|[Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3062.java)|| Easy|
5859
| 3046|[Split the Array](https://leetcode.com/problems/split-the-array/)|[Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3046.java)|| Easy|
5960
| 3042|[Count Prefix and Suffix Pairs I](https://leetcode.com/problems/count-prefix-and-suffix-pairs-i/)|[Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3042.java)|| Easy|
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
packagecom.fishercoder.solutions.fourththousand;
2+
3+
importjava.util.ArrayList;
4+
importjava.util.List;
5+
6+
publicclass_3069 {
7+
publicstaticclassSolution1 {
8+
publicint[]resultArray(int[]nums) {
9+
int[]ans =newint[nums.length];
10+
List<Integer>list1 =newArrayList<>();
11+
list1.add(nums[0]);
12+
List<Integer>list2 =newArrayList<>();
13+
list2.add(nums[1]);
14+
for (inti =2;i <nums.length;i++) {
15+
if (list1.get(list1.size() -1) >list2.get(list2.size() -1)) {
16+
list1.add(nums[i]);
17+
}else {
18+
list2.add(nums[i]);
19+
}
20+
}
21+
inti =0;
22+
for (intj =0;j <list1.size();j++) {
23+
ans[i++] =list1.get(j);
24+
}
25+
for (intj =0;j <list2.size();j++) {
26+
ans[i++] =list2.get(j);
27+
}
28+
returnans;
29+
}
30+
}
31+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp