본문 바로가기

LeetCode/코딩 테스트 스터디 2주차12

[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.
[LeetCode] 58. Length of Last Word 풀이 (JS) 0. 문제 https://leetcode.com/problems/length-of-last-word/ Length of Last Word - 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 s단어와 공백으로 구성된 문자열이 주어지면 문자열 의 마지막 단어 길이를 반환 #1 Input: s = "Hello World" Output: 5 #2 Input: s = " fly me to the moon " Output: 4 #3 Input: s = "luffy is st.. 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.