随笔分类 -  Leetcode

上一页 1 2 3 4 5 6 7 8 ··· 19 下一页
摘要:Given n nodes labeled from 0 to n - 1 and a list of undirected edges (each edge is a pair of nodes), write a function to find the number of connected 阅读全文
posted @ 2017-02-19 19:17 amazingzoe 阅读(180) 评论(0) 推荐(0)
摘要:Given two 1d vectors, implement an iterator to return their elements alternately. For example, given two 1d vectors: By calling next repeatedly until  阅读全文
posted @ 2017-02-19 17:44 amazingzoe 阅读(165) 评论(0) 推荐(0)
摘要:Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements 阅读全文
posted @ 2017-02-19 17:32 amazingzoe 阅读(119) 评论(0) 推荐(0)
摘要:Given a string, sort it in decreasing order based on the frequency of characters. Example 1: Input: "tree" Output: "eert" Explanation: 'e' appears twi 阅读全文
posted @ 2017-02-19 16:36 amazingzoe 阅读(158) 评论(0) 推荐(0)
摘要:Given a nested list of integers, return the sum of all integers in the list weighted by their depth. Each element is either an integer, or a list -- w 阅读全文
posted @ 2017-02-17 23:58 amazingzoe 阅读(139) 评论(0) 推荐(0)
摘要:Given two sparse matrices A and B, return the result of AB. You may assume that A's column number is equal to B's row number. Example: 阅读全文
posted @ 2017-02-17 23:16 amazingzoe 阅读(141) 评论(0) 推荐(0)
摘要:A group of two or more people wants to meet and minimize the total travel distance. You are given a 2D grid of values 0 or 1, where each 1 marks the h 阅读全文
posted @ 2017-02-17 22:55 amazingzoe 阅读(207) 评论(0) 推荐(0)
摘要:Given a non-empty integer array, find the minimum number of moves required to make all array elements equal, where a move is incrementing a selected e 阅读全文
posted @ 2017-02-17 22:34 amazingzoe 阅读(126) 评论(0) 推荐(0)
摘要:Given an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements that appear twi 阅读全文
posted @ 2017-02-17 22:08 amazingzoe 阅读(164) 评论(0) 推荐(0)
摘要:Given the root of a tree, you are asked to find the most frequent subtree sum. The subtree sum of a node is defined as the sum of all the node values 阅读全文
posted @ 2017-02-17 21:34 amazingzoe 阅读(200) 评论(0) 推荐(0)
摘要:In LLP world, there is a hero called Teemo and his attacking can make his enemy Ashe be in poisoned condition. Now, given the Teemo's attacking ascend 阅读全文
posted @ 2017-02-17 20:11 amazingzoe 阅读(139) 评论(0) 推荐(0)
摘要:You need to find the largest value in each row of a binary tree. Example: 阅读全文
posted @ 2017-02-17 19:13 amazingzoe 阅读(408) 评论(0) 推荐(0)
摘要:Design a hit counter which counts the number of hits received in the past 5 minutes. Each function accepts a timestamp parameter (in seconds granulari 阅读全文
posted @ 2017-02-17 18:56 amazingzoe 阅读(203) 评论(0) 推荐(0)
摘要:Given a non-negative integer represented as non-empty a singly linked list of digits, plus one to the integer. You may assume the integer do not conta 阅读全文
posted @ 2017-02-17 16:28 amazingzoe 阅读(149) 评论(0) 推荐(0)
摘要:Given a binary tree, find the leftmost value in the last row of the tree. Example 1: Example 2: Note: You may assume the tree (i.e., the given root no 阅读全文
posted @ 2017-02-17 12:03 amazingzoe 阅读(466) 评论(0) 推荐(0)
摘要:Assume you have an array of length n initialized with all 0's and are given k update operations. Each operation is represented as a triplet: [startInd 阅读全文
posted @ 2017-02-17 11:41 amazingzoe 阅读(139) 评论(0) 推荐(0)
摘要:Suppose you have a random list of people standing in a queue. Each person is described by a pair of integers (h, k), where h is the height of the pers 阅读全文
posted @ 2017-02-15 23:32 amazingzoe 阅读(184) 评论(0) 推荐(0)
摘要:A sequence of number is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the 阅读全文
posted @ 2017-02-15 23:08 amazingzoe 阅读(135) 评论(0) 推荐(0)
摘要:Given a binary tree, collect a tree's nodes as if you were doing this: Collect and remove all leaves, repeat until the tree is empty. Example:Given bi 阅读全文
posted @ 2017-02-15 22:48 amazingzoe 阅读(115) 评论(0) 推荐(0)
摘要:Given an 2D board, count how many battleships are in it. The battleships are represented with 'X's, empty slots are represented with '.'s. You may ass 阅读全文
posted @ 2017-02-13 22:38 amazingzoe 阅读(148) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 7 8 ··· 19 下一页