*@linkhttps://leetcode-cn.com/problems/permutation-in-string/ *@solutions* *@best_solutions* */export{};constlog =console.log;// s1 和 s2 仅包含小写字母functioncheckInclusion(s1: string, s2: string): boolean {constlen1 = s1.length;constlen2 = s2.length;// 如果 s1 长度大于 s2, 直...
Find all the permutations of a string 就是permutations II考虑有重复字母的情况。 String str = "someString"; char[] charArray = str.toCharArray(); 对char array进行排序: Arrays.sort(charArray) 之后再把CharArray转化成string: char[] myString = new char[] {'T', 'H', 'I', 'S', ' ',...
594. Reverse Words in a String III Easy 字符串的单词分别翻转再拼接到一起就好了 /fuxuemingzhu/article/details/70141268 595. Number of Lines To Write String Easy 使用字典保存每个字符的长度,然后统计每行的长度是否超过100就好了 /fuxuemingzhu/article/details/79810381 596. Reverse String Easy 字符串翻...
('$' means the problem is locked on Leetcode, '*' means the problem is related to Database, '#' means the problem is related to Shell, '~' means the concurrency problems.) #TitleSolutionDifficulty 1352 Product of the Last K Numbers 50.20% Medium 1351 Count Negative Numbers in a Sorted...
String #TitleSolutionTimeSpaceDifficultyTagNote 2042 Check if Numbers Are Ascending in a Sentence C++ Python O(n) O(1) Easy 2047 Number of Valid Words in a Sentence C++ Python O(n) O(1) Easy 2048 Next Greater Numerically Balanced Number C++ Python O(1) O(1) Medium Permutations, Prec...
Given a string containing only digits, restore it by returning all possible valid IP address combinations. For example: Given”25525511135”, return[“255.255.11.135”, “255.255.111.35”]. (Order does not matter) 这道题要求我们复原IP地址。
package leetcode func findSubstring(s string, words []string) []int { if len(words) == 0 { return []int{} } res := []int{} counter := map[string]int{} for _, w := range words { counter[w]++ } length, totalLen, tmpCounter := len(words[0]), len(words[0])*len(w...
LeetCode 398. Random Pick Index LC address:398. Random Pick Index Given an array of integers with possible duplicates, randomly output the index of a given target number. You can assume that the given target number must exist in the array. ...
4 Median of Two Sorted Arrays Hard 17.40% 5 Longest Palindromic Substring Medium 20.70% 6 ZigZag Conversion Easy 21.80% 7 Reverse Integer Easy 25.10% 8 String to Integer (atoi) Easy 13.00% 9 Palindrome Number Easy 28.30% 10 Regular Expression Matching Hard 20.70% 11 Container With Most Water...
终于将LeetCode的大部分题刷完了,真是漫长的第一遍啊,估计很多题都忘的差不多了,这次开个题目汇总贴,并附上每道题目的解题连接,方便之后查阅吧~ 博主还制作了一款 网页版APP,方便大家进行查阅,网址如下: https://grandyang.com 对应的 Github 项目 的同步地址如下,欢迎大家关注点赞 ️ https://github....