原文链接: https://leetcode-cn.com/problems/palindrome-partitioning-ii 英文原文Given a string s, partition s such that every substring of the partition is a palindrome. Return the minimum cuts needed for a palindrome partitioning of s. Example 1: Input: s = "…
标签详情
字符串 分类
原文链接: https://leetcode-cn.com/problems/valid-palindrome 英文原文A phrase is a palindrome if, after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters, it reads the same forward and backward. Alphanumeric …
原文链接: https://leetcode-cn.com/problems/word-break 英文原文Given a string s and a dictionary of strings wordDict, return true if s can be segmented into a space-separated sequence of one or more dictionary words. Note that the same word in the dictionary …
原文链接: https://leetcode-cn.com/problems/word-break-ii 英文原文Given a string s and a dictionary of strings wordDict, add spaces in s to construct a sentence where each word is a valid dictionary word. Return all such possible sentences in any order. Note …
原文链接: https://leetcode-cn.com/problems/reverse-words-in-a-string 英文原文Given an input string s, reverse the order of the words. A word is defined as a sequence of non-space characters. The words in s will be separated by at least one space. Return a st…
原文链接: https://leetcode-cn.com/problems/compare-version-numbers 英文原文Given two version numbers, version1 and version2, compare them. Version numbers consist of one or more revisions joined by a dot '.'. Each revision consists of digits and may contain …
原文链接: https://leetcode-cn.com/problems/fraction-to-recurring-decimal 英文原文Given two integers representing the numerator and denominator of a fraction, return the fraction in string format. If the fractional part is repeating, enclose the repeating par…
原文链接: https://leetcode-cn.com/problems/excel-sheet-column-title 英文原文Given an integer columnNumber, return its corresponding column title as it appears in an Excel sheet. For example: A -> 1 B -> 2 C -> 3 ... Z -> 26 AA -> 27 AB -> 28 ... Example 1: I…
原文链接: https://leetcode-cn.com/problems/excel-sheet-column-number 英文原文Given a string columnTitle that represents the column title as appear in an Excel sheet, return its corresponding column number. For example: A -> 1 B -> 2 C -> 3 ... Z -> 26 AA -> …
原文链接: https://leetcode-cn.com/problems/largest-number 英文原文Given a list of non-negative integers nums, arrange them such that they form the largest number. Note: The result may be very large, so you need to return a string instead of an integer. Examp…
原文链接: https://leetcode-cn.com/problems/repeated-dna-sequences 英文原文The DNA sequence is composed of a series of nucleotides abbreviated as 'A', 'C', 'G', and 'T'. For example, "ACGAATTCCG" is a DNA sequence. When studying DNA, it is useful to identify …
原文链接: https://leetcode-cn.com/problems/isomorphic-strings 英文原文Given two strings s and t, determine if they are isomorphic. Two strings s and t are isomorphic if the characters in s can be replaced to get t. All occurrences of a character must be repl…
原文链接: https://leetcode-cn.com/problems/implement-trie-prefix-tree 英文原文A trie (pronounced as "try") or prefix tree is a tree data structure used to efficiently store and retrieve keys in a dataset of strings. There are various applications of this dat…
原文链接: https://leetcode-cn.com/problems/design-add-and-search-words-data-structure 英文原文Design a data structure that supports adding new words and finding if a string matches any previously added string. Implement the WordDictionary class: WordDictiona…
原文链接: https://leetcode-cn.com/problems/word-search-ii 英文原文Given an m x n board of characters and a list of strings words, return all words on the board. Each word must be constructed from letters of sequentially adjacent cells, where adjacent cells a…
原文链接: https://leetcode-cn.com/problems/basic-calculator 英文原文Given a string s representing a valid expression, implement a basic calculator to evaluate it, and return the result of the evaluation. Note: You are not allowed to use any built-in function…
原文链接: https://leetcode-cn.com/problems/basic-calculator-ii 英文原文Given a string s which represents an expression, evaluate this expression and return its value. The integer division should truncate toward zero. You may assume that the given expression …
原文链接: https://leetcode-cn.com/problems/different-ways-to-add-parentheses 英文原文Given a string expression of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. You may return…
原文链接: https://leetcode-cn.com/problems/valid-anagram 英文原文Given two strings s and t, return true if t is an anagram of s, and false otherwise. Example 1: Input: s = "anagram", t = "nagaram" Output: true Example 2: Input: s = "rat", t = "car" Output: f…
原文链接: https://leetcode-cn.com/problems/binary-tree-paths 英文原文Given the root of a binary tree, return all root-to-leaf paths in any order. A leaf is a node with no children. Example 1: Input: root = [1,2,3,null,5] Output: ["1->2->5","1->3"] Example 2:…
原文链接: https://leetcode-cn.com/problems/integer-to-english-words 英文原文Convert a non-negative integer num to its English words representation. Example 1: Input: num = 123 Output: "One Hundred Twenty Three" Example 2: Input: num = 12345 Output: "Twelve T…
原文链接: https://leetcode-cn.com/problems/expression-add-operators 英文原文Given a string num that contains only digits and an integer target, return all possibilities to insert the binary operators '+', '-', and/or '*' between the digits of num so that the…
原文链接: https://leetcode-cn.com/problems/word-pattern 英文原文Given a pattern and a string s, find if s follows the same pattern. Here follow means a full match, such that there is a bijection between a letter in pattern and a non-empty word in s. Example …
原文链接: https://leetcode-cn.com/problems/serialize-and-deserialize-binary-tree 英文原文Serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or transmitted across …
原文链接: https://leetcode-cn.com/problems/bulls-and-cows 英文原文You are playing the Bulls and Cows game with your friend. You write down a secret number and ask your friend to guess what the number is. When your friend makes a guess, you provide a hint wit…
原文链接: https://leetcode-cn.com/problems/remove-invalid-parentheses 英文原文Given a string s that contains parentheses and letters, remove the minimum number of invalid parentheses to make the input string valid. Return all the possible results. You may re…
原文链接: https://leetcode-cn.com/problems/additive-number 英文原文Additive number is a string whose digits can form additive sequence. A valid additive sequence should contain at least three numbers. Except for the first two numbers, each subsequent number …
原文链接: https://leetcode-cn.com/problems/remove-duplicate-letters 英文原文Given a string s, remove duplicate letters so that every letter appears once and only once. You must make sure your result is the smallest in lexicographical order among all possible…
原文链接: https://leetcode-cn.com/problems/maximum-product-of-word-lengths 英文原文Given a string array words, return the maximum value of length(word[i]) * length(word[j]) where the two words do not share common letters. If no such two words exist, return 0…
原文链接: https://leetcode-cn.com/problems/verify-preorder-serialization-of-a-binary-tree 英文原文One way to serialize a binary tree is to use preorder traversal. When we encounter a non-null node, we record the node's value. If it is a null node, we record …