Skip to content

Commit

Permalink
A로 B 만들기
Browse files Browse the repository at this point in the history
  • Loading branch information
dudwns committed Apr 27, 2023
1 parent 42f8393 commit c1fe913
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Programmers/exam62.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
function solution(before, after) {
let count = 0;
const beforeArray = [...before];
const afterArray = [...after];
for (let i = 0; i < before.length; i++) {
for (let j = 0; j < after.length; j++) {
if (beforeArray[i] === afterArray[j]) {
afterArray.splice(j, 1);
count++;
break;
}
}
}

return count === after.length ? 1 : 0;
}

0 comments on commit c1fe913

Please sign in to comment.