摘要:
题目描述: 给定一个字符串数组,将字母异位词组合在一起。字母异位词指字母相同,但排列不同的字符串。 示例: 输入: ["eat", "tea", "tan", "ate", "nat", "bat"] 输出: [ ["ate","eat","tea"], ["nat","tan"], ["bat"] 阅读全文
2021年5月2日
摘要:
题目描述 给定两个字符串s和t,编写一个函数来判断t是否是s的字母异位词。 示例 1: 输入: s = "anagram", t = "nagaram" 输出: true 示例 2: 输入: s = "rat", t = "car" 输出: false 说明: 你可以假设字符串只包含小写字母。 进阶 阅读全文
摘要:
题目描述 Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are+,-,*,/. Each operand may be an integer or another e 阅读全文
摘要:
题目描述 Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique l 阅读全文
摘要:
题目描述 给定一个字符串 s,将 s 分割成一些子串,使每个子串都是回文串。返回符合要求的最少分割次数。 示例: 输入: "aab" 输出: 1 解释: 进行一次分割就可将 s 分割成 ["aa","b"] 这样两个回文子串。 方法1 暴力动态规划,LeetCode耗时40ms,内存消耗9.3MB。 阅读全文
摘要:
题目描述 Given a string s, partition s such that every substring of the partition is a palindrome.Return all possible palindrome partitioning of s. For ex 阅读全文
摘要:
题目描述 给定一个字符串,验证它是否是回文串,只考虑字母和数字字符, 可以忽略字母的大小写。 说明:本题中,我们将空字符串定义为有效的回文串。 示例 1: 输入: "A man, a plan, a canal: Panama" 输出: true 示例 2: 输入: "race a car" 输出: 阅读全文
摘要:
题目描述 判断一个整数是否是回文数。回文数是指正序(从左向右)和倒序(从右向左)读都是一样的整数。 示例 1: 输入: 121 输出: true 示例 2: 输入: -121 输出: false 解释: 从左向右读, 为 -121 。 从右向左读, 为 121- 。因此它不是一个回文数。 示例 3: 阅读全文
摘要:
题目描述 Write a function to find the longest common prefix string amongst an array of strings. 方法1 直接的思路:有点暴力o(n^2),一个个的比较排除. class Solution { public: st 阅读全文