File tree 3 files changed +35
-0
lines changed
3 files changed +35
-0
lines changed Original file line number Diff line number Diff line change 171
171
| 1002| [ 查找共用字符] ( https://leetcode.cn/problems/find-common-characters/ ) | [ JavaScript] ( ./algorithms/find-common-characters.js ) | Easy|
172
172
| 1038| [ 从二叉搜索树到更大和树] ( https://leetcode.cn/problems/binary-search-tree-to-greater-sum-tree/ ) | [ JavaScript] ( ./algorithms/binary-search-tree-to-greater-sum-tree.js ) | Medium|
173
173
| 1047| [ 删除字符串中的所有相邻重复项] ( https://leetcode.cn/problems/remove-all-adjacent-duplicates-in-string/ ) | [ JavaScript] ( ./algorithms/remove-all-adjacent-duplicates-in-string.js ) | Easy|
174
+ | 1780| [ 判断一个数字是否可以表示成三的幂的和] ( https://leetcode.cn/problems/check-if-number-is-a-sum-of-powers-of-three/ ) | [ JavaScript] ( ./algorithms/check-if-number-is-a-sum-of-powers-of-three.js ) | Medium|
174
175
| 面试题 04.12| [ 面试题 04.12. 求和路径] ( https://leetcode.cn/problems/paths-with-sum-lcci/ ) | [ JavaScript] ( ./algorithms/paths-with-sum-lcci.js ) | Medium|
175
176
| 面试题 02.07| [ 面试题 02.07. 链表相交] ( https://leetcode.cn/problems/intersection-of-two-linked-lists-lcci/ ) | [ JavaScript] ( ./algorithms/intersection-of-two-linked-lists-lcci.js ) | Easy|
176
177
| 剑指 Offer 05. 替换空格| [ 剑指 Offer 05. 替换空格] ( https://leetcode.cn/problems/ti-huan-kong-ge-lcof/ ) | [ JavaScript] ( ./algorithms/ti-huan-kong-ge-lcof.js ) | Easy|
Original file line number Diff line number Diff line change
1
+ /**
2
+ * [1780] 判断一个数字是否可以表示成三的幂的和
3
+ * @param {number } n
4
+ * @return {boolean }
5
+ */
6
+ var checkPowersOfThree = function ( n ) {
7
+ while ( n ) {
8
+ if ( n % 3 === 2 ) return false ;
9
+ n = parseInt ( n / 3 ) ;
10
+ }
11
+
12
+ return true ;
13
+ } ;
Original file line number Diff line number Diff line change
1
+ /*
2
+ * @lc app=leetcode.cn id=1780 lang=javascript
3
+ *
4
+ * [1780] 判断一个数字是否可以表示成三的幂的和
5
+ */
6
+
7
+ // @lc code=start
8
+ /**
9
+ * @param {number } n
10
+ * @return {boolean }
11
+ */
12
+ var checkPowersOfThree = function ( n ) {
13
+ while ( n ) {
14
+ if ( n % 3 === 2 ) return false ;
15
+ n = parseInt ( n / 3 ) ;
16
+ }
17
+
18
+ return true ;
19
+ } ;
20
+ // @lc code=end
21
+
You can’t perform that action at this time.
0 commit comments