[Easy] 242. Valid Anagram
leetCode/NeetCode 2022. 8. 2. 23:19

문제 Given two strings s and t, return true if t is an anagram of s, and false otherwise. An Anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once. s와 t 문자열이 주어지면, t가 s의 아나그램일 때 true를 반환하고 아니면 false를 반환한다. 아나그램이란, 단어를 구성하는 알파벳들이 다른 순서로 구성되어있는 또 다른 단어를 말한다. 예시 Example 1: Input: s = "anagram", t = "nagaram" ..

[Easy] 217. Contains Duplicate
leetCode/NeetCode 2022. 8. 2. 23:15

문제 Given an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct. 주어진 nums 배열 요소 중 중복되는 값이 있다면 true, 없으면 false를 반환하라. 예시 Example 1: Input: nums = [1,2,3,1] Output: true Example 2: Input: nums = [1,2,3,4] Output: false Example 3: Input: nums = [1,1,1,3,3,4,3,2,4,2] Output: true 제약 조건 Constraints: 1

[Easy] 860. Lemonade Change
leetCode 2022. 7. 26. 00:11

문제 At a lemonade stand, each lemonade costs $5. Customers are standing in a queue to buy from you and order one at a time (in the order specified by bills). Each customer will only buy one lemonade and pay with either a $5, $10, or $20 bill. You must provide the correct change to each customer so that the net transaction is that the customer pays $5. Note that you do not have any change in hand ..

[Easy] 1886. Determine Whether Matrix Can Be Obtained By Rotation
leetCode 2022. 6. 30. 11:32

문제 Given two n x n binary matrices mat and target, return true if it is possible to make mat equal to target by rotating mat in 90-degree increments, or false otherwise. 두 개의 n x n 이진 행렬 매트와 타겟이 주어지면 매트를 90도 단위로 회전시켜 표적으로 동일하게 만들 수 있으면 true를 반환하고 그렇지 않으면 false를 반환합니다. 예시 Example 1: Input: mat = [[0,1],[1,0]], target = [[1,0],[0,1]] Output: true Explanation: We can rotate mat 90 degrees clockwise..

[Easy] 58. Length of Last Word
leetCode 2022. 6. 17. 09:17

문제 Given a string s consisting of words and spaces, return the length of the last word in the string. A word is a maximal substring consisting of non-space characters only. 단어와 공백으로 구성된 문자열이 지정된 경우 문자열에서 마지막 단어의 길이를 반환합니다. 단어는 공백이 아닌 문자로만 구성된 최대 부분 문자열입니다. 예시 Example 1: Input: s = "Hello World" Output: 5 Explanation: The last word is "World" with length 5. Example 2: Input: s = " fly me to the m..

[Easy] 67. Add Binary
leetCode 2022. 6. 15. 16:22

문제 Given two binary strings a and b, return their sum as a binary string. 두 개의 이진 문자열 a와 b가 주어지면, 합을 이진 문자열로 반환한다. 예시 Example 1: Input: a = "11", b = "1" Output: "100" Example 2: Input: a = "1010", b = "1011" Output: "10101" 제약 조건 Constraints: 1

[Easy] 989. Add to Array-Form of Integer
leetCode 2022. 6. 15. 16:08

문제 The array-form of an integer num is an array representing its digits in left to right order. For example, for num = 1321, the array form is [1,3,2,1]. Given num, the array-form of an integer, and an integer k, return the array-form of the integer num + k. 정수 번호의 배열 형식은 왼쪽에서 오른쪽 순서로 숫자를 나타내는 배열이다. 예를 들어, num = 1321의 경우 배열 형식은 [1,3,2,1]입니다. 주어진 num, 정수의 배열 형식 및 정수 k가 주어지면 정수 num + k의 배열 형식을 반환한..

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