![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
leetcode
malimaliao
请叫我软件工程师!
展开
-
leetcode 1 TwoSum
leetcode 1. TwoSum问题描述: Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution,原创 2017-02-18 22:52:37 · 258 阅读 · 0 评论 -
leetcode 72. Edit Distance
72. Edit Distance方法: 1. 动态规划方法 2. dp[i][j] 表示word1前i个字符转到word2前j个字符所需的步骤 3. 如果word1.charAt(i) == word2.charAt(j) dp[i][j] == dp[i - 1][j - 1];, 否则dp[i][j] = 1 + min(dp[i][j - 1], dp[i - 1][j], dp[i原创 2017-08-12 22:36:42 · 225 阅读 · 0 评论 -
leetcode: 76. Minimum Window Substring
76. Minimum Window Substring方法: 1. 用两个指针left, right 来指定一个窗口 2. 利用Map存储子串的字符和该字符的数量 3. 移动right来找到一个合法的窗口 4. 移动left来找到该合法窗口下的最小合法窗口代码:public class Solution { public String minWindow(String s, Str原创 2017-08-12 22:39:34 · 219 阅读 · 0 评论 -
leetcode: 79 Word Search
79 Word Search方法: 对矩阵中的每一个字符做递归比较,每比较一个字符将该字符置为‘$’,以防止该字符被第二次比较。递归程序注意结束递归的条件。代码:public class Solution { public boolean exist(char[][] board, String word) { if(board == null || board.lengt原创 2017-08-12 22:40:47 · 220 阅读 · 0 评论