Skip to content

Commit 1ada270

Browse files
edit 390
1 parent bb242ea commit 1ada270

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ Your ideas/fixes/algorithms are more than welcome!
208208
|396|[Rotate Function](https://leetcode.com/problems/rotate-function/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_396.java)| O(n^2) could be optimized to O(n) | O(1) | Easy|
209209
|393|[UTF-8 Validation](https://leetcode.com/problems/utf-8-validation/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_393.java)| O(?)|O(?) | Medium| Bit Manipulation
210210
|392|[Is Subsequence](https://leetcode.com/problems/is-subsequence/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_392.java)| O(m*n)|O(1) | Medium| Array, String
211-
|390|[Elimination Game](https://leetcode.com/problems/elimination-game/)|[Solution](../master/src/main/java/com/fishercoder/solutions/EliminationGame.java)| O(logn)|O(1) | Medium|
211+
|390|[Elimination Game](https://leetcode.com/problems/elimination-game/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_390.java)| O(logn)|O(1) | Medium|
212212
|389|[Find the Difference](https://leetcode.com/problems/find-the-difference/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_389.java)| O(n)|O(1) | Easy|
213213
|388|[Longest Absolute File Path](https://leetcode.com/problems/longest-absolute-file-path/)|[Solution](../master/src/main/java/com/fishercoder/solutions/LongestAbsoluteFilePath.java)| O(n)|O(d) | Medium| Stack
214214
|387|[First Unique Character in a String](https://leetcode.com/problems/first-unique-character-in-a-string/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_387.java)| O(n)|O(n) | Easy| HashMap

src/main/java/com/fishercoder/solutions/EliminationGame.java renamed to src/main/java/com/fishercoder/solutions/_390.java

+11-9
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
import java.util.ArrayList;
44
import java.util.List;
55

6-
/**There is a list of sorted integers from 1 to n. Starting from left to right, remove the first number and every other number afterward until you reach the end of the list.
7-
8-
Repeat the previous step again, but this time from right to left, remove the right most number and every other number from the remaining numbers.
9-
10-
We keep repeating the steps again, alternating left to right and right to left, until a single number remains.
11-
12-
Find the last number that remains starting with a list of length n.
6+
/**There is a list of sorted integers from 1 to n.
7+
* Starting from left to right,
8+
* remove the first number and every other number afterward until you reach the end of the list.
9+
* Repeat the previous step again, but this time from right to left,
10+
* remove the right most number and every other number from the remaining numbers.
11+
* We keep repeating the steps again, alternating left to right and right to left, until a single number remains.
12+
* Find the last number that remains starting with a list of length n.
1313
1414
Example:
1515
@@ -21,8 +21,10 @@
2121
6
2222
2323
Output:
24-
6*/
25-
public class EliminationGame {
24+
6
25+
26+
*/
27+
public class _390 {
2628

2729
//then I turned to Discuss and found this post: https://discuss.leetcode.com/topic/55870/share-my-solutions-for-contest-2
2830
//instead of literally removing half of the elements in each scan, this solution is just moving the pointer to point to next start position

0 commit comments

Comments
 (0)