[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] 110. Balanced Binary Tree
leetCode 2022. 6. 13. 01:44

문제 Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined as : a binary tree in which the left and right subtrees of every node differ in height by no more than 1. 이진 트리가 주어지면 높이 균형이 맞는지 확인합니다. 이 문제에서 높이 균형 이진 트리는 다음과 같이 정의됩니다. : 모든 노드 의 왼쪽 및 오른쪽 하위 트리의 높이가 1 이하로 다른 이진 트리. 예시 Example 1: Input: root = [3,9,20,null,null,15,7] Output: tru..

[Easy] 459. Repeated Substring Pattern
leetCode 2022. 6. 13. 01:39

문제 Given a string s, check if it can be constructed by taking a substring of it and appending multiple copies of the substring together. 문자열이 주어지면, 그 문자열의 부분 문자열이 원본 문자열을 여러 개로 구성할 수 있는지 판별하여 true, false를 반환하시오. 예시 ample 1: Input: s = "abab" Output: true Explanation: It is the substring "ab" twice. Example 2: Input: s = "aba" Output: false Example 3: Input: s = "abcabcabcabc" Output: true Explan..

[Easy] 896. Monotonic Array
leetCode 2022. 6. 9. 11:22

문제 An array is monotonic if it is either monotone increasing or monotone decreasing. An array nums is monotone increasing if for all i

[Easy] 28. Implement strStr()
leetCode 2022. 6. 9. 11:16

문제 Implement strStr(). Given two strings needle and haystack, return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. Clarification: What should we return when needle is an empty string? This is a great question to ask during an interview. For the purpose of this problem, we will return 0 when needle is an empty string. This is consistent to C's s..

[Easy] 303. Range Sum Query - Immutable
leetCode 2022. 6. 8. 13:27

문제 Given an integer array nums, handle multiple queries of the following type: Calculate the sum of the elements of nums between indices left and right inclusive where left

[Easy] 1603. Design Parking System
leetCode 2022. 6. 8. 13:25

문제 Design a parking system for a parking lot. The parking lot has three kinds of parking spaces: big, medium, and small, with a fixed number of slots for each size. Implement the ParkingSystem class: ParkingSystem(int big, int medium, int small) Initializes object of the ParkingSystem class. The number of slots for each parking space are given as part of the constructor. bool addCar(int carType)..

[Easy] 404. Sum of Left Leaves
leetCode 2022. 6. 6. 17:40

문제 Given the root of a binary tree, return the sum of all left leaves. A leaf is a node with no children. A left leaf is a leaf that is the left child of another node. root이진 트리가 주어지면 모든 왼쪽 잎의 합을 반환합니다. 리프는 자식이 없는 노드입니다 . 왼쪽 리프 는 다른 노드의 왼쪽 자식인 리프입니다. 예시 Example 1: Input: root = [3,9,20,null,null,15,7] Output: 24 Explanation: There are two left leaves in the binary tree, with values 9 and 15 resp..