반응형

번역 3

[LeetCode] 11. Container With Most Water (Java)

문제 You are given an integer array height of length n. 길이가 n인 정수 배열 'height'가 제공됩니다. There are n vertical lines drawn such that the two endpoints of the ith line are (i, 0) and (i, height[i]). i번째 선의 두 끝점이 (i, 0) 및 (i, height[i])가 되도록 n개의 수직선이 그려집니다. Find two lines that together with the x-axis form a container, such that the container contains the most water. 컨테이너에 가장 많은 물이 포함되도록 컨테이너의 x축과 함께 형성..

[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비트 정수(부호가 있거나 없는)를 저장할 수 없..

반응형