Tag: dynamic programming

Leetcode 76 Minimum Window Substring 最小窗口子串

Leetcode 76 Minimum Window Substring 最小窗口子串

Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n). Example: Input: S = “ADOBECODEBANC”, T = “ABC” Output: “BANC” Note: If there is no such window in S that 

Leetcode 279. Perfect Squares 经典一维动态规划问题

Leetcode 279. Perfect Squares 经典一维动态规划问题

题目表述 Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, …) which sum to n. Example 1: Input: n = 12 Output: 3 Explanation: 12 = 4 + 4 + 4. Example 2: Input: n