字符串
Data Structures & Algorithms · 25 notes
- Longest Common Substringhistorical
Given two strings str1 and str2, return their longest common substring. The problem guarantees that the longest common substring of str1 and str2 exists and is unique.
- Longest Common Subsequencehistorical
Given two strings text1 and text2, return the length of their longest common subsequence.
- Longest Substring Without Repeating Charactershistorical
Given an array, return the length of its longest contiguous subarray without repeated elements.
- Edit Distancehistorical
Given two words word1 and word2, calculate the minimum number of operations required to convert word1 into word2.
- Word Breakhistorical
Given a non-empty string s and a list wordDict containing non-empty words, determine whether s can be segmented by spaces into one or more words that appear in the dictionary.
- Word Searchhistorical
Given a two-dimensional grid and a word, determine whether the word exists in the grid.
- Longest Common Substringhistorical
Given two strings str1 and str2, output their longest common substring. The problem guarantees that the longest common substring of str1 and str2 exists and is unique.
- Longest Common Subsequencehistorical
Given two strings text1 and text2, return the length of their longest common subsequence.
- Letter Combinations of a Phone Numberhistorical
Given a string containing only digits 2-9, return all letter combinations it can represent. The answer may be returned in any order.
- Edit Distancehistorical
Given two words word1 and word2, calculate the minimum number of operations required to convert word1 into word2.
- Group Anagramshistorical
Given an array of strings, group the anagrams together. Anagrams contain the same letters but in a different order.
- Find All Anagrams in a Stringhistorical
Given a string s and a non-empty string p, find all substrings in s that are anagrams of p and return their starting indexes.
- Longest Common Prefixhistorical
Write a function to find the longest common prefix among an array of strings.
- Check Palindromehistorical
Given a string, write a function to determine whether it is a palindrome. Return true if it is, otherwise return false.
- Reverse Stringhistorical
Write a program that accepts a string and outputs the reversed string. (The string length does not exceed 1000.).
- Palindromic Substringshistorical
Given a string, calculate how many palindromic substrings it contains.
- Longest Palindromic Substringhistorical
Given a string s, find the longest palindromic substring in s.
- Big Number Additionhistorical
Read two numbers as strings, write a function to calculate their sum, and return the result as a string. (The string length does not exceed 100000, and each string contains only the ten characters '0'~'9'.).
- Longest Valid Parentheseshistorical
Given a string containing only '(' and ')', find the length of the longest valid (well-formed and consecutive) parentheses substring.
- Remove Invalid Parentheseshistorical
Given a string s containing parentheses and letters, remove the minimum number of invalid parentheses to make the input string valid.
- Generate Parentheseshistorical
The number n represents the number of pairs of parentheses. Design a function that can generate all possible valid combinations of parentheses.
- Valid Parentheseshistorical
Given a string containing only the characters '(', ')', '{', '}', '[' and ']', determine whether the string is a valid parentheses sequence. Parentheses must close in the correct order.
- Regular Expression Matchinghistorical
Given a string s and a pattern p, implement regular expression matching with support for '.' and '*'.
- Longest Substring Without Repeating Charactershistorical
Given an array, return the length of its longest contiguous subarray without repeated elements.