본문 바로가기

LeetCode easy19

[LeetCode] 70. Climbing Stairs 풀이 (JS) 0. 문제 https://leetcode.com/problems/climbing-stairs/ Climbing Stairs - 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 n높이의 계단을 1또는 2스텝을 한 번에 오를 수 있다고 가정할때 top으로 올라갈 수 있는 경우의 수를 계산하는 문제 #1 Input: n = 2 Output: 2 Explanation: There are two ways to climb to the top. 1. 1 step + 1 ste.. 2022. 7. 24.
[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] 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.