上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 29 下一页
摘要: 题目: 字符串轮转。给定两个字符串s1和s2,请编写代码检查s2是否为s1旋转而成(比如,waterbottle是erbottlewat旋转后的字符串)。 示例1: 输入:s1 = "waterbottle", s2 = "erbottlewat" 输出:True示例2: 输入:s1 = "aa", 阅读全文
posted @ 2020-03-02 16:03 silentteller 阅读(432) 评论(0) 推荐(0)
摘要: 题目: 编写一种算法,若M × N矩阵中某个元素为0,则将其所在的行与列清零。 示例 1: 输入:[ [1,1,1], [1,0,1], [1,1,1]]输出:[ [1,0,1], [0,0,0], [1,0,1]]示例 2: 输入:[ [0,1,2,0], [3,4,5,2], [1,3,1,5] 阅读全文
posted @ 2020-03-02 15:42 silentteller 阅读(245) 评论(0) 推荐(0)
摘要: 题目: 给定一幅由N × N矩阵表示的图像,其中每个像素的大小为4字节,编写一种方法,将图像旋转90度。 不占用额外内存空间能否做到? 示例 1: 给定 matrix = [ [1,2,3], [4,5,6], [7,8,9]], 原地旋转输入矩阵,使其变为:[ [7,4,1], [8,5,2], 阅读全文
posted @ 2020-03-02 14:55 silentteller 阅读(301) 评论(0) 推荐(0)
摘要: 题目: https://leetcode-cn.com/problems/compress-string-lcci/ 字符串压缩。利用字符重复出现的次数,编写一种方法,实现基本的字符串压缩功能。比如,字符串aabcccccaaa会变为a2b1c5a3。若“压缩”后的字符串没有变短,则返回原先的字符串 阅读全文
posted @ 2020-03-01 15:48 silentteller 阅读(260) 评论(0) 推荐(0)
摘要: 题目: 字符串有三种编辑操作:插入一个字符、删除一个字符或者替换一个字符。 给定两个字符串,编写一个函数判定它们是否只需要一次(或者零次)编辑。 示例 1: 输入: first = "pale"second = "ple"输出: True 示例 2: 输入: first = "pales"secon 阅读全文
posted @ 2020-03-01 15:21 silentteller 阅读(327) 评论(0) 推荐(0)
摘要: 题目: 给定一个字符串,编写一个函数判定其是否为某个回文串的排列之一。 回文串是指正反两个方向都一样的单词或短语。排列是指字母的重新排列。 回文串不一定是字典当中的单词。 示例1: 输入:"tactcoa"输出:true(排列有"tacocat"、"atcocta",等等) 分析: 我们可以观察回文 阅读全文
posted @ 2020-03-01 14:45 silentteller 阅读(290) 评论(0) 推荐(0)
摘要: 题目: URL化。编写一种方法,将字符串中的空格全部替换为%20。假定该字符串尾部有足够的空间存放新增字符,并且知道字符串的“真实”长度。(注:用Java实现的话,请使用字符数组实现,以便直接在数组上操作。) 示例1: 输入:"Mr John Smith ", 13 输出:"Mr%20John%20 阅读全文
posted @ 2020-03-01 14:36 silentteller 阅读(249) 评论(0) 推荐(0)
摘要: 题目: https://leetcode-cn.com/problems/check-permutation-lcci/ 给定两个字符串 s1 和 s2,请编写一个程序,确定其中一个字符串的字符重新排列后,能否变成另一个字符串。 示例 1: 输入: s1 = "abc", s2 = "bca"输出: 阅读全文
posted @ 2020-03-01 14:06 silentteller 阅读(317) 评论(0) 推荐(0)
摘要: 题目: https://leetcode-cn.com/problems/is-unique-lcci/ 实现一个算法,确定一个字符串 s 的所有字符是否全都不同。 示例 1: 输入: s = "leetcode"输出: false 示例 2: 输入: s = "abc"输出: true限制: 0 阅读全文
posted @ 2020-03-01 13:53 silentteller 阅读(334) 评论(0) 推荐(0)
摘要: 题目: There are a total of n courses you have to take, labeled from 0 to n-1. Some courses may have prerequisites, for example to take course 0 you have 阅读全文
posted @ 2020-02-29 15:27 silentteller 阅读(298) 评论(0) 推荐(0)
上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 29 下一页