This is a follow up of Shortest Word Distance. The only difference is now word1 could be the same as wo…
分类:LeetCode题目解答
[LeetCode] Maximum Length of Repeated Subarray 最长的重复子数组
Given two integer arrays A and B, return the maximum length of an subarray that appears in both arrays.…
[LeetCode] Reorganize String 重构字符串
Given a string S, check if the letters can be rearranged so that two characters that are adjacent …
LeetCode | Best Time to Buy and Sell Stock III
题目: Say you have an array for which the ith element is the price of a given stock on day i. Des…
198. House Robber
You are a professional robber planning to rob houses along a street. Each house has a certain amount of money …
28. Implement strStr()
28. Implement strStr() 题目 Implement strStr(). Return the index of the first occurrence of needle in haystack, …
[LeetCode] LFU Cache 最近最不常用页面置换缓存器
Design and implement a data structure for Least Frequently Used (LFU) cache. It should suppor…
257. Binary Tree Paths
题目 https://leetcode.com/problems/binary-tree-paths/discuss/68279/C++-non-recursive-version-and-recursive-versi…
[LeetCode] Word Ladder II 词语阶梯之二,Word Ladder,Word Ladder
Given two words (beginWord and endWord), and a dictionary’s word list, find all shortes…
[LeetCode] Baseball Game 棒球游戏
You’re now a baseball game point recorder. Given a list of strings, each string can be one of the…
LeetCode | Permutations
题目: Given a collection of numbers, return all possible permutations. For example,[1,2,3] have the followi…
LeetCode 207 Course Schedule
题目描述 There are a total of n courses you have to take, labeled from 0 to n – 1. Some courses may have pre…