上一页 1 2 3 4 5 6 7 8 9 ··· 27 下一页
摘要: Given a non-empty array of integers, return the k most frequent elements.For example, Given [1,1,1,2,2,3] and k = 2, return [1,2]. Note: You may assume k is always valid, 1 ≤ k ≤ number of unique ele... 阅读全文
posted @ 2017-12-26 00:14 xiejunzhao 阅读(253) 评论(0) 推荐(0)
摘要: Find the minimum length word from a given dictionary words, which has all the letters from the string licensePlate. Such a word is said to complete the given string licensePlate Here, for letters we... 阅读全文
posted @ 2017-12-21 23:49 xiejunzhao 阅读(183) 评论(0) 推荐(0)
摘要: On a staircase, the i-th step has some non-negative cost cost[i] assigned (0 indexed). Once you pay the cost, you can either climb one or two steps. You need to find minimum cost to reach the top o... 阅读全文
posted @ 2017-12-20 22:13 xiejunzhao 阅读(849) 评论(0) 推荐(0)
摘要: A zero-indexed array A of length N contains all integers from 0 to N-1. Find and return the longest length of set S, where S[i] = {A[i], A[A[i]], A[A[A[i]]], ... } subjected to the rule below.Suppos... 阅读全文
posted @ 2017-12-15 22:37 xiejunzhao 阅读(571) 评论(0) 推荐(0)
摘要: Implement a magic directory with buildDict, and search methods.For the method buildDict, you'll be given a list of non-repetitive words to build a dictionary.For the method search, you'll be given a w... 阅读全文
posted @ 2017-12-14 22:23 xiejunzhao 阅读(236) 评论(0) 推荐(0)
摘要: Implement a trie with insert, search, and startsWith methods. Note: You may assume that all inputs are consist of lowercase letters a-z. var Trie = function() { this.nodes = {};};Trie.prototype.in... 阅读全文
posted @ 2017-12-14 22:23 xiejunzhao 阅读(160) 评论(0) 推荐(0)
摘要: Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums except nums[i].Solve it without division and in O(n).For ... 阅读全文
posted @ 2017-12-11 22:36 xiejunzhao 阅读(117) 评论(0) 推荐(0)
摘要: Let's play the minesweeper game (Wikipedia, online game)! You are given a 2D char matrix representing the game board. 'M' represents an unrevealed mine, 'E' represents an unrevealed empty square, 'B' ... 阅读全文
posted @ 2017-12-11 22:36 xiejunzhao 阅读(201) 评论(0) 推荐(0)
摘要: Given a list of sorted characters letters containing only lowercase letters, and given a target letter target, find the smallest element in the list that is larger than the given target.Letters also ... 阅读全文
posted @ 2017-12-11 22:35 xiejunzhao 阅读(315) 评论(0) 推荐(0)
摘要: You are given a license key represented as a string S which consists only alphanumeric character and dashes. The string is separated into N+1 groups by N dashes.Given a number K, we would want to re... 阅读全文
posted @ 2017-12-10 11:05 xiejunzhao 阅读(273) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 8 9 ··· 27 下一页