摘要: Given a singly linked list, return a random node's value from the linked list. Each node must have the same probability of being chosen. Follow up:Wha 阅读全文
posted @ 2017-02-19 19:34 amazingzoe 阅读(138) 评论(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 assum 阅读全文
posted @ 2017-02-19 19:27 amazingzoe 阅读(145) 评论(0) 推荐(0)
摘要: 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 阅读(176) 评论(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 阅读(161) 评论(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 阅读(114) 评论(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 阅读(147) 评论(0) 推荐(0)