반응형

Algorithm 5

[LeetCode] 12. Integer_to_Roman (JAVA)

문제 Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. 로마 숫자는 I, V, X, L, C, D 그리고 M의 7가지 기호로 표시됩니다. Symbol Value I 1 V 5 X 10 L 50 C 100 D 500 M 1000 For example, 2 is written as II in Roman numeral, just two one's added together. 예를 들어, 2는 로마 숫자로 II로 표기되며, 일을 두번 더하면 됩니다. 12 is written as XII, which is simply X + II. 12는 XII로 표기되며, 단순히 X + II입니다. The number 27 is ..

[LeetCode] 9. Palindrome Number (Java)

문제 Given an integer x, returntrue if x is palindrome integer. 정수 x가 주어지면, x가 회문 정수이면 true를 반환하세요. An integer is a palindrome when it reads the same backward as forward. 정수는 정방향과 역방향이 같을 때 회문입니다. For example, 121 is a palindrome while 123 is not. 예를 들어, 121은 회문이지만 123은 아닙니다. 회문이란? 회문(回文) 또는 팰린드롬(palindrome)은 거꾸로 읽어도 제대로 읽는 것과 같은 문장이나 낱말, 숫자, 문자열(sequence of characters) 등이다. 보통 낱말 사이에 있는 띄어쓰기나 문장 ..

[LeetCode] 8. String to Integer (atoi) (Java)

문제 Implement the myAtoi(string s) function, which converts a string to a 32-bit signed integer (similar to C/C++'s atoi function). 문자열을 32비트 부호 있는 정수로 변환하는 myAtoi(string s)함수를 구현합니다(C/C++의 atoi함수와 유사). The algorithm for myAtoi(string s) is as follows: myAtoi(string s)의 알고리즘은 다음과 같습니다: Read in and ignore any leading whitespace. 공백을 읽고 무시하세요. Check if the next character (if not already at the end ..

[LeetCode] 7. Reverse Integer (Java)

문제 Given a signed 32-bit integer x, return x with its digits reversed. If reversing x causes the value to go outside the signed 32-bit integer range [-231, 231 - 1], then return 0. 부호 있는 32비트 정수 x이 주어지면 숫자가 반전된 x를 반환합니다. x를 반전하면 값이 부호 있는 32비트 정수 범위 [-231, 231 - 1]를 벗어나면 0을 반환합니다. Assume the environment does not allow you to store 64-bit integers (signed or unsigned). 65비트 정수(부호가 있거나 없는)를 저장할 수 없..

[LeetCode] 6. Zigzag Converstion (Java)

문제 The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) 문자열 "PAYPALISHIRING"은 다음과 같이 주어진 수의 행들에 지그재그 패턴으로 작성되어있습니다.(가독성을 높이기 위해 이 패턴을 고정 글꼴로 표시할 수 있습니다.) P A H N A P L S I I G Y I R And then read line by line: "PAYPALISHIRING" 그런 다음 한 줄씩 읽습니다: "PAYPALISHIRING" 문자열을 가져가고 주어진 수의 ..

반응형