동적 프로그래밍2 LeetCode 5. Valid Parentheses [Strings, Stack] Problem: Given a string 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. Note that an empty string is also considered valid. Example 1: Input: "()" Output: true Example 2: Input: "()[]{}" Output: true Exa.. 2020. 6. 12. 5. Longest Palindromic Substring [Strings, dynamic programming] Problems: Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example 1: Input: "babad" Output: "bab" Note: "aba" is also a valid answer. Example 2: Input: "cbbd" Output: "bb" -Summary- Approach: Expand around the center 1. Two cases exist. - Palindrome with odd lengths of string (example: 'aba', 'abcba') --> where 1 character in th.. 2020. 6. 11. 이전 1 다음