본문 바로가기

분류 전체보기33

[LeetCode] 69. Sqrt(x) 풀이 (JS) 0. 문제 https://leetcode.com/problems/sqrtx/ Sqrt(x) - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 제곱근을 구하는 문제 #1 Input: x = 4 Output: 2 #2 Input: x = 8 Output: 2 1.언어 자바스크립트(JavaScript) 2. 문제 풀이 var mySqrt = function(x) { return parseInt(Math.sqrt(x)) }; Runtime: 100 ms, faster .. 2022. 7. 24.
[LeetCode] 67. Add Binary 풀이 (JS) 0. 문제 https://leetcode.com/problems/add-binary/ Add Binary - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 두 개의 이진 문자열 a 및 b가 주어지면 그 합계를 이진 문자열로 반환합니다 . #1 Input: a = "11", b = "1" Output: "100" #2 Input: a = "1010", b = "1011" Output: "10101" 1.언어 자바스크립트(JavaScript) 2. 문제 풀이 var.. 2022. 7. 24.
[LeetCode] 8. String to Integer (atoi) 풀이 (JS) 0. 문제 https://leetcode.com/problems/string-to-integer-atoi/ String to Integer (atoi) - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 1. 선행 공백을 무시하고 읽습니다. 2. 다음 문자(아직 문자열 끝에 있지 않은 경우)가 '-' 또는 '+'인지 확인합니다. 이 문자 중 하나일 경우 이를 확인합니다. 최종 결과가 각각 음수인지 양수인지를 결정합니다. 부호가 둘 다 없으면 결과가 양수라고 가정합.. 2022. 7. 17.
[LeetCode] 66. Plus One 풀이 (JS) 0. 문제 https://leetcode.com/problems/plus-one/ Plus One - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 각 자릿수가 배열로 주어진 하나의 수에 1을 더한 값을 각 자릿수 배열로 반환하는 문제 ex : [9, 9, 9] → 999 + 1 = 1000 → [1, 0, 0, 0] #1 Input: digits = [1,2,3] Output: [1,2,4] #2 Input: digits = [4,3,2,1] Output: [.. 2022. 7. 17.