본문 바로가기
728x90

LeetCode78

[LeetCode] 11. 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 i^th 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. Notice that you may not slant the container. Example 1: Input: heigh.. 2023. 10. 18.
[LeetCode] 10. Regular Expression Matching Given an input string s and a pattern p, implement regular expression matching with support for ' . ' and ' * ' where: ' . ' Matches any single character.​​​​ ' * ' Matches zero or more of the preceding element. The matching should cover the entire input string (not partial). Example 1: Input: s = "aa", p = "a" Output: false Explanation: "a" does not match the entire string "aa". Example 2: Inpu.. 2023. 10. 18.
[LeetCode] 9. Palindrome Number Given an integer x, return true if x is a palindrome, and false otherwise. 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: false Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is not a palindrome. Example 3: Input: x = 10 Output: false Explanation:.. 2023. 10. 17.
[LeetCode] 8. String to Integer (atoi) Implement the myAtoi(string s) function, which converts a string to a 32-bit signed integer (similar to C/C++'s atoi function). The algorithm for myAtoi(string s) is as follows: 1. Read in and ignore any leading whitespace. 2. Check if the next character (if not already at the end of the string) is ' - ' or ' + '. Read this character in if it is either. This determines if the final result is neg.. 2023. 10. 16.
728x90