본문 바로가기

leetcode8

[LeetCode] 36. Valid Sudoku 문제 링크 >> https://leetcode.com/problems/valid-sudoku/ 📋 문제 Determine if a 9 x 9 Sudoku board is valid. Only the filled cells need to be validated according to the following rules: Each row must contain the digits 1-9 without repetition. Each column must contain the digits 1-9 without repetition. Each of the nine 3 x 3 sub-boxes of the grid must contain the digits 1-9 without repetition. Note: A S.. 2022. 4. 17.
[LeetCode] Valid Parentheses 문제 링크 >> https://leetcode.com/problems/valid-parentheses/ 📋 문제 Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if: Open brackets must be closed by the same type of brackets. Open brackets must be closed in the correct order. 👉 입출력 Example 1: Input: s = "()" Output: true Example 2: Input: s = "()[]{}.. 2022. 4. 12.
[LeetCode] Container With Most Water 문제 링크 >> https://leetcode.com/problems/container-with-most-water/ 📋 문제 You are given an integer array height of length n. There are n vertical lines drawn such that the two endpoints of the ith line are (i, 0) and (i, height[i]). Find two lines that together with the x-axis form a container, such that the container contains the most water. Return the maximum amount of water a container can store.. 2022. 4. 11.
[LeetCode] Assign Cookies 문제 링크 >> https://leetcode.com/problems/assign-cookies/ 📋 문제 Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i has a greed factor g[i], which is the minimum size of a cookie that the child will be content with; and each cookie j has a size s[j]. If s[j] >= g[i], we can assign the cookie j to the child i, .. 2022. 4. 9.
[LeetCode] Valid Palindrome 문제 링크 >> https://leetcode.com/problems/valid-palindrome/ 📋 문제 A phrase is a palindrome if, after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters, it reads the same forward and backward. Alphanumeric characters include letters and numbers. Given a string s, return true if it is a palindrome, or false otherwise. 👉 입출력 Example 1: Input: s = "A ma.. 2022. 4. 9.
[LeetCode] Palindrome Number 문제 링크 >> https://leetcode.com/problems/palindrome-number/ 📋 문제 Given an integer x, return true if x is palindrome integer. An integer is a palindrome when it reads the same backward as forward. For example, 121 is a palindrome while 123 is not. 👉 입출력 Example 1: Input: x = 121 Output: true Explanation: 121 reads as 121 from left to right and from right to left. Example 2: Input: x = -121 Output: .. 2022. 4. 9.
[LeetCode] Longest Word in Dictionary 문제 링크 >> https://leetcode.com/problems/longest-word-in-dictionary/ 📋 문제 Given an array of strings words representing an English Dictionary, return the longest word in words that can be built one character at a time by other words in words. If there is more than one possible answer, return the longest word with the smallest lexicographical order. If there is no answer, return the empty string. 👉 .. 2022. 1. 31.
[LeetCode] Two Sum 문제 링크 >> https://leetcode.com/problems/two-sum/ 📋 문제 Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You may assume that each input would have exactly one solution, and you may not use the same element twice. You can return the answer in any order. 👉 입출력 예제 Example 1: Input: nums = [2,7,11,15], target = 9 Output: [0,1] Exp.. 2022. 1. 25.