솔루션 const solution = (my_string) => { const nums = my_string.match(/[0-9]+/g); const answer = nums ? nums.map((num) => +num).reduce((a, c) => a + c, 0) : 0; console.log(answer); return answer; }; 솔루션 function solution(my_string) { const answer = my_string.split(/\D+/).reduce((acc, cur) => acc + Number(cur), 0); console.log(answer); return answer; } 솔루션 function solution(n) { let answer = "" for(..
솔루션 function solution(board) { const isBombNearby = (r, c) => { const nearby = [ [-1, -1], [-1, 0], [-1, 1], [0, -1], [0, 1], [1, -1], [1, 0], [1, 1], ]; const isInBoard = (r, c) => r >= 0 && r = 0 && c isInBoard(r + dR, c + dC) && board[r + dR][c + dC] === 1 ); }; let answer = 0; for (let r = 0; r < board.length; r++) { for ..
솔루션 function solution(sides) { const min = Math.min(...sides); const max1 = Math.max(...sides); const max2 = min + max1 - 1; return max2 - (max1 - min); } 솔루션 function solution(sides) { return Math.min(...sides) * 2 - 1; }
솔루션 const solution = (spell, dic) => { const sort = (str) => [...str].sort((a, b) => (a sort(dic) === sort(spell.join(""))) ? 1 : 2; console.log(answer); return answer; }; solution(["p", "o", "s"], ["sod", "eocd", "qixm", "adio", "soo"]); solution(["z", "d", "x"], ["def", "dww", "dzx", "loveaw"]); solution(["s", "o", "m", "d..
솔루션 const solution = (dots) => { const getInclination = ([[x1, y1], [x2, y2]]) => x2 !== x1 ? (y2 - y1) / (x2 - x1) : Infinity; const isParallel = (line1, line2) => getInclination(line1) === getInclination(line2); const answer = dots.some((dot) => { const line1 = [dots[0], dot]; const line2 = dots.filter((dot) => !line1.includes(dot)); return isParallel(line1, line2); }) ? 1 : 0; console.log(ans..
내 블로그 - 관리자 홈 전환 |
Q
Q
|
---|---|
새 글 쓰기 |
W
W
|
글 수정 (권한 있는 경우) |
E
E
|
---|---|
댓글 영역으로 이동 |
C
C
|
이 페이지의 URL 복사 |
S
S
|
---|---|
맨 위로 이동 |
T
T
|
티스토리 홈 이동 |
H
H
|
단축키 안내 |
Shift + /
⇧ + /
|
* 단축키는 한글/영문 대소문자로 이용 가능하며, 티스토리 기본 도메인에서만 동작합니다.