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

Commit 7264986

Browse files
solve: 문자열 묶기
1 parent d00790e commit 7264986

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

‎Level0/PRO181857.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Solution 1
2+
function solution1(strArr) {
3+
const counterList = [];
4+
5+
for (const str of strArr) {
6+
counterList[str.length] === undefined
7+
? (counterList[str.length] = 1)
8+
: (counterList[str.length] += 1);
9+
}
10+
11+
return Math.max(...counterList.filter((element) => !isNaN(element)));
12+
}
13+
14+
// Solution 2
15+
function solution2(strArr) {
16+
const counterMap = new Map();
17+
18+
for (const str of strArr) {
19+
counterMap.set(str.length, counterMap.has(str.length) ? counterMap.get(str.length) + 1 : 1);
20+
}
21+
22+
return Math.max(...counterMap.values());
23+
}

‎README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,3 +289,4 @@
289289
| 23.11.18. | `Level 0` | [최빈값 구하기](https://school.programmers.co.kr/learn/courses/30/lessons/120812) | [JS](https://github.com/JeongHwan-dev/Algorithm-solving-with-js/blob/master/Level0/PRO120812.js) |
290290
| 23.11.19. | `Level 0` | [합성수 찾기](https://school.programmers.co.kr/learn/courses/30/lessons/120846) | [JS](https://github.com/JeongHwan-dev/Algorithm-solving-with-js/blob/master/Level0/PRO120846.js) |
291291
| 23.11.21. | `Level 0` | [1로 만들기](https://school.programmers.co.kr/learn/courses/30/lessons/181880) | [JS](https://github.com/JeongHwan-dev/Algorithm-solving-with-js/blob/master/Level0/PRO181880.js) |
292+
| 23.11.21. | `Level 0` | [문자열 묶기](https://school.programmers.co.kr/learn/courses/30/lessons/181855) | [JS](https://github.com/JeongHwan-dev/Algorithm-solving-with-js/blob/master/Level0/PRO181855.js) |

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /