摘要:题目:Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telep...
阅读全文
摘要:题目:Given two integersnandk, return all possible combinations ofknumbers out of 1 ...n.For example,Ifn= 4 andk= 2, a solution is:[ [2,4], [3,4], [2,...
阅读全文
摘要:题目:Given a collection of numbers that might contain duplicates, return all possible unique permutations.For example,[1,1,2]have the following unique p...
阅读全文
摘要:题目:Given a collection of numbers, return all possible permutations.For example,[1,2,3]have the following permutations:[1,2,3],[1,3,2],[2,1,3],[2,3,1],...
阅读全文
摘要:题目:Given a collection of integers that might contain duplicates,nums, return all possible subsets.Note:Elements in a subset must be in non-descending ...
阅读全文
摘要:题目:Given a set of distinct integers,nums, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set must ...
阅读全文
摘要:题目:Write an efficient algorithm that searches for a value in anmxnmatrix. This matrix has the following properties:Integers in each row are sorted fro...
阅读全文
摘要:题目:Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in...
阅读全文
摘要:题目:Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the ...
阅读全文
摘要:题目:Given an array withnobjects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red,...
阅读全文
摘要:题目:Given an unsorted integer array, find the first missing positive integer.For example,Given[1,2,0]return3,and[3,4,-1,1]return2.Your algorithm should...
阅读全文
摘要:题目:Sort a linked list inO(nlogn) time using constant space complexity.代码:/** * Definition for singly-linked list. * struct ListNode { * int val; *...
阅读全文
摘要:题目:Sort a linked list using insertion sort.代码:/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ...
阅读全文
摘要:题目:Mergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity.代码:/** * Definition for singly-linked list. * struc...
阅读全文
摘要:题目:Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.代码:/**...
阅读全文
摘要:题目:Given two sorted integer arraysnums1andnums2, mergenums2intonums1as one sorted array.Note:You may assume thatnums1has enough space (size that is gr...
阅读全文
摘要:题目:Given a binary tree containing digits from0-9only, each root-to-leaf path could represent a number.An example is the root-to-leaf path1->2->3which ...
阅读全文
摘要:题目:Given a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example:Given the below binary tree, 1 ...
阅读全文
摘要:题目:Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tree andsu...
阅读全文
摘要:题目:Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum...
阅读全文