File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change 176
176
| 1832| [ 判断句子是否为全字母句] ( https://leetcode.cn/problems/check-if-the-sentence-is-pangram/ ) | [ JavaScript] ( ./algorithms/check-if-the-sentence-is-pangram.js ) | Easy|
177
177
| 1945| [ 字符串转化后的各位数字之和] ( https://leetcode.cn/problems/sum-of-digits-of-string-after-convert/ ) | [ JavaScript] ( ./algorithms/sum-of-digits-of-string-after-convert.js ) | Easy|
178
178
| 2032| [ 至少在两个数组中出现的值] ( https://leetcode.cn/problems/two-out-of-three/ ) | [ JavaScript] ( ./algorithms/two-out-of-three.js ) | Easy|
179
+ | 2283| [ 判断一个数的数字计数是否等于数位的值] ( https://leetcode.cn/problems/check-if-number-has-equal-digit-count-and-digit-value/ ) | [ JavaScript] ( ./algorithms/check-if-number-has-equal-digit-count-and-digit-value.js ) | Easy|
179
180
| 面试题 04.12| [ 面试题 04.12. 求和路径] ( https://leetcode.cn/problems/paths-with-sum-lcci/ ) | [ JavaScript] ( ./algorithms/paths-with-sum-lcci.js ) | Medium|
180
181
| 面试题 02.07| [ 面试题 02.07. 链表相交] ( https://leetcode.cn/problems/intersection-of-two-linked-lists-lcci/ ) | [ JavaScript] ( ./algorithms/intersection-of-two-linked-lists-lcci.js ) | Easy|
181
182
| 剑指 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
+ * @param {string } num
3
+ * @return {boolean }
4
+ */
5
+ var digitCount = function ( num ) {
6
+ const map = Array ( 10 ) . fill ( 0 ) ;
7
+
8
+ for ( let i = 0 ; i < num . length ; i ++ ) {
9
+ map [ num [ i ] ] ++ ;
10
+ }
11
+ for ( let i = 0 ; i < num . length ; i ++ ) {
12
+ if ( map [ i ] != num [ i ] ) {
13
+ return false ;
14
+ }
15
+ }
16
+ return true ;
17
+ } ;
You can’t perform that action at this time.
0 commit comments