[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] 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] 953. Verifying an Alien Dictionary
leetCode 2022. 6. 2. 12:07

문제 Easy 2841940Add to ListShare In an alien language, surprisingly, they also use English lowercase letters, but possibly in a different order. The order of the alphabet is some permutation of lowercase letters. Given a sequence of words written in the alien language, and the order of the alphabet, return true if and only if the given words are sorted lexicographically in this alien language. 외계..

[Easy] 1672. Richest Customer Wealth
leetCode 2022. 5. 31. 11:57

문제 You are given an m x n integer grid accounts where accounts[i][j] is the amount of money the i​​​​​​​​​​​th​​​​ customer has in the j​​​​​​​​​​​th​​​​ bank. Return the wealth that the richest customer has. A customer's wealth is the amount of money they have in all their bank accounts. The richest customer is the customer that has the maximum wealth. 고객이 은행 에 가지고 있는 금액은 m x n정수 그리드 accounts가 ..

[Easy] 496. Next Greater Element I
leetCode 2022. 5. 31. 00:55

문제 The next greater element of some element x in an array is the first greater element that is to the right of x in the same array. You are given two distinct 0-indexed integer arrays nums1 and nums2, where nums1 is a subset of nums2. For each 0

[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] 1502. Can Make Arithmetic Progression From Sequence
leetCode 2022. 5. 30. 00:30

문제 A sequence of numbers is called an arithmetic progression if the difference between any two consecutive elements is the same. Given an array of numbers arr, return true if the array can be rearranged to form an arithmetic progression. Otherwise, return false. arr 배열의 요소들간의 차가 일정하면 true, 일정하지 않다면 false를 반환한다. 예시 Example 1: Input: arr = [3,5,1] Output: true Explanation: We can reorder the eleme..

[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..