티스토리 뷰
https://www.acmicpc.net/problem/1919
1919번: 애너그램 만들기
두 영어 단어가 철자의 순서를 뒤바꾸어 같아질 수 있을 때, 그러한 두 단어를 서로 애너그램 관계에 있다고 한다. 예를 들면 occurs 라는 영어 단어와 succor 는 서로 애너그램 관계에 있는데, occurs
www.acmicpc.net
const fs = require('fs');
const [A, B] = fs
.readFileSync('./dev/stdin')
.toString()
.trim()
.split('\n')
.map((v) => v.split(''));
let answer = 0;
while (A.length > 0) {
const a = A.shift();
const index = B.findIndex((v) => v == a);
if (index >= 0) {
B.splice(index, 1);
} else {
answer++;
}
}
answer += B.length;
console.log(answer);
728x90
'자료구조 알고리즘 > 백준' 카테고리의 다른 글
Node.js) 백준 1475번: 방 번호 (0) | 2023.06.17 |
---|---|
Node.js) 백준 13300번: 방 배정 (0) | 2023.06.17 |
Node.js) 백준 19238번 : 스타트 택시 (0) | 2023.06.17 |
Node.js)백준 11328번: Strfry (0) | 2023.06.16 |
Node.js) 백준 10807번: 개수 세기 (0) | 2023.06.16 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 개발자면접
- MOD
- 동적프로그래밍
- 다이나밍프로그래밍
- 롱베케이션
- node.js
- create db
- DB 생성
- 투포인터
- 투포인터 연습
- 로드나인
- 면접비
- 서버개발
- 최소공통조상
- 은둔청년체험
- MySQL
- 면접질문
- create databases;
- 그래프
- 서버점검
- BFS
- 다이나믹프로그래밍
- KMP
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함