-
-
Notifications
You must be signed in to change notification settings - Fork 112
Expand file tree
/
Copy pathindex.js
More file actions
74 lines (25 loc) · 692 Bytes
/
index.js
File metadata and controls
74 lines (25 loc) · 692 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
function handle(str) {
}
// 答案慎看
// /**
// * @description:
// * 1. 思路通过对象的key设置数量
// * 2. 获取对象中最小的值
// * 3. 循环字符串,对比最小值与当前字符不相等
// * 4. 可以输出。
// * @param {type} str
// * @return {type} res
// */
// function handle(str) {
// let obj = {}
// let res = ''
// for (let i = 0; i < str.length; i++) {
// if (obj[str[i]]) obj[str[i]]++
// else obj[str[i]] = 1
// }
// let min = Math.min(...Object.values(obj))
// for (let i = 0; i < str.length; i++) {
// if (obj[str[i]] !== min) res += str[i]
// }
// return res
// }