随笔分类 -  Algorithm

上一页 1 ··· 5 6 7 8 9 10 下一页
摘要:Given two integers A and B, return any string S such that: S has length A + B and contains exactly A 'a' letters, and exactly B 'b' letters; The subst 阅读全文
posted @ 2019-02-10 02:08 Review->Improve 阅读(570) 评论(0) 推荐(0)
摘要:This problem was asked by Microsoft. A number is considered perfect if its digits sum up to exactly 10. Given a positive integer n, return the n-th pe 阅读全文
posted @ 2019-02-06 01:14 Review->Improve 阅读(214) 评论(0) 推荐(0)
摘要:Given the root of a binary tree, each node has a value from 0 to 25 representing the letters 'a' to 'z': a value of 0 represents 'a', a value of 1 rep 阅读全文
posted @ 2019-02-05 12:48 Review->Improve 阅读(626) 评论(0) 推荐(0)
摘要:This problem was asked by Google. On our special chessboard, two bishops attack each other if they share the same diagonal. This includes bishops that 阅读全文
posted @ 2019-02-05 02:51 Review->Improve 阅读(1947) 评论(0) 推荐(0)
摘要:Given a binary tree, find the length of the longest path where each node in the path has the same value. This path may or may not pass through the roo 阅读全文
posted @ 2019-01-04 23:44 Review->Improve 阅读(410) 评论(0) 推荐(0)
摘要:This problem was recently asked by Google. Given a list of numbers and a number k, return whether any two numbers from the list add up to k. For examp 阅读全文
posted @ 2018-12-22 06:20 Review->Improve 阅读(319) 评论(0) 推荐(0)
摘要:Given an array nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k num 阅读全文
posted @ 2018-12-22 06:01 Review->Improve 阅读(307) 评论(0) 推荐(0)
摘要:This problem was asked by Google. Implement locking in a binary tree. A binary tree node can be locked or unlocked only if all of its descendants or a 阅读全文
posted @ 2018-12-22 02:35 Review->Improve 阅读(3067) 评论(0) 推荐(0)
摘要:Implement a trie with insert, search, and startsWith methods. Notice You may assume that all inputs are consist of lowercase letters a-z. Implement a 阅读全文
posted @ 2018-12-15 05:59 Review->Improve 阅读(239) 评论(0) 推荐(0)
摘要:This problem was asked by Twitter. You run an e-commerce website and want to record the last N order ids in a log. Implement a data structure to accom 阅读全文
posted @ 2018-12-14 01:45 Review->Improve 阅读(1829) 评论(0) 推荐(0)
摘要:Given an array of integers A with even length, return true if and only if it is possible to reorder it such that A[2 * i + 1] = 2 * A[2 * i] for every 阅读全文
posted @ 2018-12-10 14:22 Review->Improve 阅读(592) 评论(0) 推荐(0)
摘要:Given a string, find the length of the longest substring T that contains at most k distinct characters. Example 1: Input: s = "eceba", k = 2 Output: 3 阅读全文
posted @ 2018-12-10 12:11 Review->Improve 阅读(3095) 评论(0) 推荐(0)
摘要:Given an array nums of n integers where n > 1, return an array output such that output[i] is equal to the product of all the elements of nums except n 阅读全文
posted @ 2018-11-30 00:18 Review->Improve 阅读(169) 评论(0) 推荐(0)
摘要:Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), ..., (an, bn) which makes sum of 阅读全文
posted @ 2018-11-11 01:30 Review->Improve 阅读(132) 评论(0) 推荐(0)
摘要:Given a n-ary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest le 阅读全文
posted @ 2018-11-10 01:59 Review->Improve 阅读(351) 评论(0) 推荐(0)
摘要:A quadtree is a tree data in which each internal node has exactly four children: topLeft, topRight, bottomLeft and bottomRight. Quad trees are often u 阅读全文
posted @ 2018-11-08 00:39 Review->Improve 阅读(642) 评论(0) 推荐(0)
摘要:Given an array of integers nums, write a method that returns the "pivot" index of this array. We define the pivot index as the index where the sum of 阅读全文
posted @ 2018-11-06 23:59 Review->Improve 阅读(183) 评论(0) 推荐(0)
摘要:Given a set of distinct positive integers, find the largest subset such that every pair (Si, Sj) of elements in this subset satisfies: Si % Sj = 0 or  阅读全文
posted @ 2017-11-12 13:21 Review->Improve 阅读(211) 评论(0) 推荐(0)
摘要:Given an integer array, heapify it into a min-heap array. For a heap array A, A[0] is the root of heap, and for each A[i], A[i * 2 + 1] is the left ch 阅读全文
posted @ 2017-11-08 14:43 Review->Improve 阅读(395) 评论(0) 推荐(0)
摘要:Given an directed graph, a topological order of the graph nodes is defined as follow: For each directed edge A -> B in graph, A must appear before B i 阅读全文
posted @ 2017-11-07 12:44 Review->Improve 阅读(414) 评论(0) 推荐(0)

上一页 1 ··· 5 6 7 8 9 10 下一页