본문 바로가기

LeetCode Medium8

[LeetCode] 15. 3Sum 풀이 (JS) 0. 문제 https://leetcode.com/problems/3sum/ 3Sum - 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 숫자로 이루어진 배열이 주어 질 때, 합이 0이 되는 세개의 원소를 배열로 리턴 #1 Input: nums = [-1,0,1,2,-1,-4] Output: [[-1,-1,2],[-1,0,1]] Explanation: nums[0] + nums[1] + nums[2] = (-1) + 0 + 1 = 0. nums[1] + nums[2.. 2022. 7. 24.
[LeetCode] 12. Integer to Roman 풀이 (JS) 0. 문제 https://leetcode.com/problems/integer-to-roman/ Integer to Roman - 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 로마 숫자는 7가지 기호로 표시됩니다 Symbol Value I 1 V 5 X 10 L 50 C 100 D 500 M 1000 로마 숫자는 일반적으로 왼쪽에서 오른쪽으로 큰 것에서 작은 것 순으로 표기한다. 하지만 아래 6가지의 경우 오른쪽에서 왼쪽으로 작은 것에서 큰 것으로 표기되며 빼.. 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] 7. Reverse Integer 풀이 (JS) 0. 문제 https://leetcode.com/problems/reverse-integer/ Reverse Integer - 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 부호 있는 32비트 정수가 주어지면 숫자를 반전하여 반환 #1 Input: x = 123 Output: 321 #2 Input: x = -123 Output: -321 #3 Input: x = 120 Output: 21 1.언어 자바스크립트(JavaScript) 2. 문제 풀이 var rev.. 2022. 7. 17.