### 题意 Given a List of words, return the words that can be typed using letters of alphabet on only one row's of American keyboard like the image below. 给定一个单词列表,只返回可以使用在键盘同一行的字母打印出来的单词。键盘如下图所示。 . 网格中的格子水平和垂直方向相...
阅读全文>>2018年5月17日 15:19 作者:nancy 分类:[LeetCode] 1246
### 题意 Given n points in the plane that are all pairwise distinct, a "boomerang" is a tuple of points (i, j, k) such that the distance between i and j equals the distance between i and k (the order of the tuple matters). 给定平面上 n 对不同的点,“回旋镖” 是由...
阅读全文>>2018年5月17日 13:50 作者:nancy 分类:[LeetCode] 1319
### 题意 Given a string s and a non-empty string p, find all the start indices of p's anagrams in s. 给定一个字符串 s 和一个非空字符串 p,找到 s 中所有是 p 的字母异位词的子串,返回这些子串的起始索引。 Strings consists of lowercase English letters only and the length of both strings s a...
阅读全文>>2018年5月16日 12:16 作者:nancy 分类:[LeetCode] 1600
### 题意 Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters. 给定一个包含大写字母和小写字母的字符串,找到通过这些字母构造成的最长的回文串。 This is case sensitive, for example "Aa" is not...
阅读全文>>2018年5月16日 09:49 作者:nancy 分类:[LeetCode] 1299
### 题意 Given two strings s and t which consist of only lowercase letters. 给定两个字符串 s 和 t,它们只包含小写字母。 String t is generated by random shuffling string s and then add one more letter at a random position. 字符串 t 由字符串 s 随机重排,然后在随机位置添加一个字母。 ...
阅读全文>>2018年5月15日 15:46 作者:nancy 分类:[LeetCode] 1408
### 题意 Given two arrays, write a function to compute their intersection. 给定两个数组,写一个方法来计算它们的交集。 Example: ``` Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2, 2]. ``` Note: - Each element in the result should appear as many times...
阅读全文>>2018年5月15日 10:29 作者:nancy 分类:[LeetCode] 1241
### 题意 Given two arrays, write a function to compute their intersection. 给定两个数组,写一个函数来计算它们的交集。 Example: ``` Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2]. ``` Note: - Each element in the result must be unique. - 每个在结果中的元素必定...
阅读全文>>2018年5月15日 09:28 作者:nancy 分类:[LeetCode] 1377
### 题意 Given a pattern and a string str, find if str follows the same pattern. 给定一种 pattern(模式) 和一个字符串 str ,判断 str 是否遵循这种模式。 Here follow means a full match, such that there is a bijection between a letter in pattern and a non-empty word in ...
阅读全文>>2018年5月14日 19:14 作者:nancy 分类:[LeetCode] 1311
### 题意 Given two strings s and t, write a function to determine if t is an anagram of s. 给定两个字符串 s 和 t,编写函数判断 t 是否为 s 的 anagram (字谜游戏,由颠倒字母顺序而构成的字[短语])。 Example 1: ``` Input: s = "anagram", t = "nagaram" Output: true ``` Example 2: ``...
阅读全文>>2018年5月13日 20:59 作者:nancy 分类:[LeetCode] 1230
你还没有登录,请 或者