[Medium] 43. Multiply Strings
leetCode 2022. 6. 15. 08:45

문제 Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2, also represented as a string. Note: You must not use any built-in BigInteger library or convert the inputs to integer directly. 문자열로 표현되는 음이 아닌 정수 num1과 num2가 주어지면 num1과 num2의 곱을 반환한다. 참고: 기본 제공 Big Integer 라이브러리를 사용하거나 입력을 정수로 직접 변환할 수 없습니다. 예시 Example 1: Input: num1 = "2", num2 = "3" O..

[Easy] 150. Evaluate Reverse Polish Notation
leetCode 2022. 6. 13. 13:44

문제 Evaluate the value of an arithmetic expression in Reverse Polish Notation. Valid operators are +, -, *, and /. Each operand may be an integer or another expression. Note that division between two integers should truncate toward zero. It is guaranteed that the given RPN expression is always valid. That means the expression would always evaluate to a result, and there will not be any division b..

[Easy] 66. Plus One
leetCode 2022. 6. 13. 13:34

문제 You are given a large integer represented as an integer array digits, where each digits[i] is the ith digit of the integer. The digits are ordered from most significant to least significant in left-to-right order. The large integer does not contain any leading 0's. Increment the large integer by one and return the resulting array of digits. 정수 배열 자릿수로 표현되는 큰 정수가 제공되며, 여기서 각 자릿수[i]는 정수의 i번째 자리..

[Easy] 1290. Convert Binary Number in a Linked List to Integer
leetCode 2022. 6. 6. 14:25

문제 Given head which is a reference node to a singly-linked list. The value of each node in the linked list is either 0 or 1. The linked list holds the binary representation of a number. Return the decimal value of the number in the linked list. 단일 head연결 목록에 대한 참조 노드가 지정됩니다. 연결 목록의 각 노드 값은 0또는 1입니다. 연결 목록은 숫자의 이진 표현을 보유합니다. 연결 목록에 있는 숫자 의 10진수 값 을 반환합니다 . 예시 Example 1: Input: head = [1,0,1] Outp..

[Easy] 1232. Check If It Is a Straight Line
leetCode 2022. 5. 30. 14:53

문제 You are given an array coordinates, coordinates[i] = [x, y], where [x, y] represents the coordinate of a point. Check if these points make a straight line in the XY plane. 예시 Example 1: Input: coordinates = [[1,2],[2,3],[3,4],[4,5],[5,6],[6,7]] Output: true Example 2: Input: coordinates = [[1,1],[2,2],[3,4],[4,5],[5,6],[7,7]] Output: false 제약 조건 Constraints: 2

[Easy] 202. Happy Number
leetCode 2022. 5. 30. 01:02

문제 Write an algorithm to determine if a number n is happy. A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of its digits. Repeat the process until the number equals 1 (where it will stay), or it loops endlessly in a cycle which does not include 1. Those numbers for which this process ends in 1 are happy..

[Easy] 1822. Sign of the Product of an Array
leetCode 2022. 5. 30. 00:21

문제 There is a function signFunc(x) that returns: 1 if x is positive. -1 if x is negative. 0 if x is equal to 0. You are given an integer array nums. Let product be the product of all values in the array nums. Return signFunc(product). nums 배열의 요소들을 모두 곱했을 때 양수면 1 반환, 음수면 -1 반환, 0이면 0을 반환한다. 예시 Example 1: Input: nums = [-1,-2,-3,-4,3,2,1] Output: 1 Explanation: The product of all values in the ar..

[Easy] 976. Largest Perimeter Triangle
leetCode 2022. 5. 28. 18:35

문제 Given an integer array nums, return the largest perimeter of a triangle with a non-zero area, formed from three of these lengths. If it is impossible to form any triangle of a non-zero area, return 0. nums 배열이 들어오면, 그 중 세 개의 요소로 이루어진 삼각형의 가장 큰 둘레를 반환한다. 삼각형을 만드는 것이 불가능하면 0을 반환한다. 예시 Example 1: Input: nums = [2,1,2] Output: 5 Example 2: Input: nums = [1,2,1] Output: 0 제약조건 Constraints: 3