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

Commitee6eed6

Browse files
edit 326
1 parentcba27f1 commitee6eed6

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

‎README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ Your ideas/fixes/algorithms are more than welcome!
266266
|329|[Longest Increasing Path in a Matrix](https://leetcode.com/problems/longest-increasing-path-in-a-matrix/)|[Solution](../master/src/main/java/com/fishercoder/solutions/LongestIncreasingPathInAMatrix.java)| O(?)|O(?)| Hard|
267267
|328|[Odd Even Linked List](https://leetcode.com/problems/odd-even-linked-list/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_328.java)| O(n)|O(1) | Medium| Linked List
268268
|327|[Count of Range Sum](https://leetcode.com/problems/count-of-range-sum/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_327.java)| O(?)|O(?)| Hard|
269+
|326|[Power of Three](https://leetcode.com/problems/power-of-three/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_326.java)| O(1)|O(1) | Easy| Math
269270
|325|[Maximum Size Subarray Sum Equals k](https://leetcode.com/problems/maximum-size-subarray-sum-equals-k/)|[Solution] | O(n)|O(n) | Medium| HashMap
270271
|324|[Wiggle Sort II](https://leetcode.com/problems/wiggle-sort-ii/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_324.java)| O(n)|O(n) | Medium| Sort
271272
|323|[Number of Connected Components in an Undirected Graph](https://leetcode.com/problems/number-of-connected-components-in-an-undirected-graph/)|[Solution](../master/src/main/java/com/fishercoder/solutions/NumberOfConnectedComponentsInAnUndirectedGraph.java)| O(?)|O(?)| Medium|

‎src/main/java/com/fishercoder/solutions/PowerOfThree.javarenamed to‎src/main/java/com/fishercoder/solutions/_326.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
packagecom.fishercoder.solutions;
2-
/**326. Power of Three QuestionEditorial Solution My Submissions
3-
Total Accepted: 57555
4-
Total Submissions: 151383
5-
Difficulty: Easy
2+
3+
/**326. Power of Three
4+
*
65
Given an integer, write a function to determine if it is a power of three.
76
87
Follow up:
98
Could you do it without using any loop / recursion?
10-
119
*/
1210

13-
publicclassPowerOfThree {
11+
publicclass_326 {
1412
//then I turned to the Editorial solution, it's pretty elegant to use base conversion which can be easily extended to any radix k
1513
//Idea: for a number in base 10, if it's power of 10, then it must be in this format: 10, 100, 1000... with a leading one and all trailing zeros
1614
//similarly, if a number is power of 3, then in its base 3 format, it must be in this format as well: 10, 100, 1000, 1000...
@@ -35,7 +33,7 @@ public boolean isPowerOfThree(int n) {
3533
}
3634

3735
publicstaticvoidmain(String...strings){
38-
PowerOfThreetest =newPowerOfThree();
36+
_326test =new_326();
3937
System.out.println(test.isPowerOfThree(12));
4038

4139
//find the max integer that is power of 3

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp