摘要:
Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According to the definition of LCA on Wikipedia: “The lowes 阅读全文
摘要:
Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum. Note: A leaf is a node with no children. Exampl 阅读全文
摘要:
Numbers can be regarded as product of its factors. For example, Write a function that takes an integer n and return all possible combinations of its f 阅读全文
摘要:
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 1 Input: 2 [ 3 1->4->5, 4 1->3->4, 5 2->6 6 ] 7 Out 阅读全文
摘要:
Given a collection of intervals, merge all overlapping intervals. Example 1: 题意: 给定一些区间,将重叠部分合并。 思路: 将原interval集合里,给定区间按照start开头值的从小到大排序 建一个新的interval 阅读全文
摘要:
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 阅读全文
摘要:
Given a string array words, find the maximum value of length(word[i]) * length(word[j]) where the two words do not share common letters. You may assum 阅读全文
摘要:
Given a list of non negative integers, arrange them such that they form the largest number. 题意: 给定一堆数字,将它们排列顺序,使其连一块儿能形成最大的数。 思路: 先转化成一个字符串数组 然后把这个数组按 阅读全文