12 2017 档案

摘要:Implement pow(x, n). // /**// * @param {number} x// * @param {number} n// * @return {number}// */// var myPow = function (x, n) {// return Math.pow(x, n);// };/** * @param {number} x * @param ... 阅读全文
posted @ 2017-12-29 22:55 xiejunzhao 阅读(234) 评论(0) 推荐(0) 编辑
摘要:In English, we have a concept called root, which can be followed by some other words to form another longer word - let's call this word successor. For example, the root an, followed by other, which c... 阅读全文
posted @ 2017-12-29 22:55 xiejunzhao 阅读(200) 评论(0) 推荐(0) 编辑
摘要:Given a circular array (the next element of the last element is the first element of the array), print the Next Greater Number for every element. The Next Greater Number of a number x is the first ... 阅读全文
posted @ 2017-12-29 22:55 xiejunzhao 阅读(201) 评论(0) 推荐(0) 编辑
摘要:Given a binary tree, return the inorder traversal of its nodes' values. For example: Given binary tree [1,null,2,3], 1 \ 2 / 3 return [1,3,2]. Note: Recursive solution is trivial, c... 阅读全文
posted @ 2017-12-27 22:32 xiejunzhao 阅读(179) 评论(0) 推荐(0) 编辑
摘要:In a given integer array nums, there is always exactly one largest element. Find whether the largest element in the array is at least twice as much as every other number in the array. If it is, ret... 阅读全文
posted @ 2017-12-26 22:16 xiejunzhao 阅读(430) 评论(0) 推荐(0) 编辑
摘要: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 阅读(247) 评论(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 阅读(176) 评论(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 阅读(837) 评论(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 阅读(526) 评论(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 阅读(227) 评论(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 阅读(150) 评论(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 阅读(183) 评论(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 阅读(111) 评论(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 阅读(307) 评论(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 阅读(267) 评论(0) 推荐(0) 编辑
摘要:Given a list of daily temperatures, produce a list that, for each day in the input, tells you how many days you would have to wait until a warmer temperature. If there is no future day for which ... 阅读全文
posted @ 2017-12-06 22:43 xiejunzhao 阅读(423) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示