사랑하애오
close
프로필 배경
프로필 로고

사랑하애오

  • 분류 전체보기
    • 정보처리기사 기출문제
      • 2020년
    • AWS
    • HTML, CSS, Layout, Grid
    • JavaScript, JQuery
    • C++
    • Node.js
    • Linux
      • centosOS
    • BlockChain
      • 기술면접
      • 비트코인
      • 이더리움
    • VSCode
    • Network
    • Solidity
    • JAVA
      • SpringBoot
      • SpringBoot Shoppingmall
      • SpringBoot CRUD Board
      • Eclipse
    • MySQL
    • React.JS
      • Redux-Saga
    • 프로그래머스(Javascript)
      • Level 0
  • 홈
  • 태그
  • 방명록

[프로그래머스 | 자바스크립트] 이진수 더하기

솔루션 const solution = (bin1, bin2) => { const answer = (parseInt(bin1, 2) + parseInt(bin2, 2)).toString(2); console.log(answer); return answer; }; 솔루션 const solution = (bin1, bin2) => { let temp = Number(bin1) + Number(bin2); temp = [...temp.toString()].reverse().map((v) => +v); for (let i = temp.length; i < 11; i++) { temp.push(0); } for (let i = 0; i < temp.length; i++) { if (temp[i] === 2) { t..

  • format_list_bulleted 프로그래머스(Javascript)/Level 0
  • · 2023. 2. 25.
  • textsms

[프로그래머스 | 자바스크립트] A로 B만들기

솔루션 const solution = (before, after) => { const sort = (str) => [...str].sort((a, b) => (a { const answer = before.split("").sort().join("") === after.split("").sort().join("") ? 1 : 0; console.log(answer); return answer; };

  • format_list_bulleted 프로그래머스(Javascript)/Level 0
  • · 2023. 2. 25.
  • textsms

[프로그래머스 | 자바스크립트] k의 개수

솔루션 const solution = (a, b, c) => { let answer = 0; for (let i = a; i +v === c).length; } console.log(answer); return answer; };

  • format_list_bulleted 프로그래머스(Javascript)/Level 0
  • · 2023. 2. 24.
  • textsms

[프로그래머스 | 자바스크립트] 중복된 문자 제거

솔루션 const solution = (my_string) => { const str = [...my_string]; let answer = []; for (let i = 0; i < str.length; i++) { if (!answer.includes(str[i])) { answer.push(str[i]); } else { continue; } } console.log(answer.join("")); return answer.join(""); }; 솔루션 function solution(my_string) { return [...new Set(my_string)].join(''); } 스프레드 연산자에서 바로 생성자 사용 가능한거 하나 배움 그리고 굳이 split으로 나눌 필요도 없음

  • format_list_bulleted 프로그래머스(Javascript)/Level 0
  • · 2023. 2. 23.
  • textsms

[프로그래머스 | 자바스크립트] 삼각형의 완성조건 (1)

솔루션 const solution = (sides) => { const max = Math.max(...sides); const answer = max a + c, 0) - max ? 1 : 2; console.log(answer); return answer; }; 솔루션 const solution = (sides) => { sides = sides.sort((a, b) => a - b); const answer = sides[0] + sides[1] > sides[2] ? 1 : 2; console.log(answer); return answer; };

  • format_list_bulleted 프로그래머스(Javascript)/Level 0
  • · 2023. 2. 23.
  • textsms

[프로그래머스 | 자바스크립트] 가까운 수

솔루션 const solution = (array, n) => { const minDiff = Math.min(...array.map((v) => Math.abs(v - n))); console.log(minDiff); const answer = array .sort((a, b) => a - b) .find((a) => Math.abs(a - n) === minDiff); console.log(answer); return answer; }; Math 메서드의 min(최솟값)과 abs(절댓값)을 이용

  • format_list_bulleted 프로그래머스(Javascript)/Level 0
  • · 2023. 2. 22.
  • textsms
  • navigate_before
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • ···
  • 8
  • navigate_next
Copyright © 쭈미로운 생활 All rights reserved.
Designed by JJuum

티스토리툴바