Computer Science/Algorithm 29

[Leetcode] [미결] 10. Regular Expression Matching

1. 문제 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: Input:..

[Leetcode] 8. String to Integer (atoi)

비추천이 너무 많아서 살펴보니 쓸데없는 복잡한 케이스를 만들어서 if문을 너무 많이 강제한다는 의견들이 많다. 테스트 자체에 대한 생각 외에 더 이상 탐색하는건 시간 낭비인 문제인 것 같다. 간단해보이는 문제라도 많은 케이스가 존재한다. 처음부터 차분히 풀어야한다. 여러 번 돌려보면서 케이스 스터디를 하는게 낫다. 문제를 푸는 입장이라면 내가 케이스들을 다 생각할 필요가 없다. 영어 해석도 일단 대충하고 실행을 여러 번하는게 낫다. ---------------------------------아래 내용은 안 봐도 됨 1. 문제 Implement the myAtoi(string s) function, which converts a string to a 32-bit signed integer (similar ..

[LeetCode] 3. Longest Substring Without Repeating Characters

1. 문제 Medium Given a string s, find the length of the longest substring without repeating characters. Example 1: Input: s = "abcabcbb" Output: 3 Explanation: The answer is "abc", with the length of 3. Example 2: Input: s = "bbbbb" Output: 1 Explanation: The answer is "b", with the length of 1. Example 3: Input: s = "pwwkew" Output: 3 Explanation: The answer is "wke", with the length of 3. Notice..