Skip to content

Commit a4d5c3e

Browse files
edit 342
1 parent 9bd4891 commit a4d5c3e

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ Your ideas/fixes/algorithms are more than welcome!
249249
|345|[Reverse Vowels of a String](https://leetcode.com/problems/reverse-vowels-of-a-string/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_345.java) | O(n) |O(1) | Easy | String
250250
|344|[Reverse String](https://leetcode.com/problems/reverse-string/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_344.java) | O(n) |O(1) | Easy | String
251251
|343|[Integer Break](https://leetcode.com/problems/integer-break/)|[Solution](../master/src/main/java/com/fishercoder/solutions/IntegerBreak.java)| O(1)|O(1) | Medium| Math
252+
|342|[Power of Four](https://leetcode.com/problems/power-of-four/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_342.java)| O(n)|O(1) | Easy| Math
252253
|341|[Flatten Nested List Iterator](https://leetcode.com/problems/flatten-nested-list-iterator/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_341.java)| O(n)|O(n) | Medium| Stack
253254
|340|[Longest Substring with At Most K Distinct Characters](https://leetcode.com/problems/longest-substring-with-at-most-k-distinct-characters/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_340.java)| O(n)|O(1) | Hard| Sliding Window
254255
|339|[Nested List Weight Sum](https://leetcode.com/problems/nested-list-weight-sum/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_339.java)| O(n)|O(h)) | Easy| DFS

src/main/java/com/fishercoder/solutions/PowerOfFour.java renamed to src/main/java/com/fishercoder/solutions/_342.java

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
package com.fishercoder.solutions;
2-
/**342. Power of Four QuestionEditorial Solution My Submissions
3-
Total Accepted: 31004
4-
Total Submissions: 86897
5-
Difficulty: Easy
2+
/**342. Power of Four
63
Given an integer (signed 32 bits), write a function to check whether it is a power of 4.
74
85
Example:
96
Given num = 16, return true. Given num = 5, return false.
107
118
Follow up: Could you solve it without loops/recursion?*/
12-
public class PowerOfFour {
9+
public class _342 {
1310
//with my original idea in the bottom, just dive a little bit deeper, you can realize that another important feature of a number
1411
//that is power of four is that its only single one bit must appear on the odd position, and power of two won't meet this requirement
1512
//decimal number 8 has binary format: 0000-0000-0000-0000-0000-0000-0000-1000

0 commit comments

Comments
 (0)