随笔分类 -  cpp刷Leetcode

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

第一遍刷完leetcode,过程非常纠结。 第二遍再过leetcode,看看自己能记得多少,顺便加深印象。
【Letter Combinations of a Phone Number】cpp
摘要:题目: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... 阅读全文

posted @ 2015-05-22 13:58 承续缘 阅读(221) 评论(0) 推荐(0) 编辑

【Combinations】cpp
摘要:题目: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,... 阅读全文

posted @ 2015-05-21 20:46 承续缘 阅读(190) 评论(0) 推荐(0) 编辑

【Permutations II】cpp
摘要:题目:Given a collection of numbers that might contain duplicates, return all possible unique permutations.For example,[1,1,2]have the following unique p... 阅读全文

posted @ 2015-05-21 16:04 承续缘 阅读(205) 评论(0) 推荐(0) 编辑

【Permutations】cpp
摘要:题目: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],... 阅读全文

posted @ 2015-05-21 10:47 承续缘 阅读(305) 评论(0) 推荐(0) 编辑

【Subsets II】cpp
摘要:题目:Given a collection of integers that might contain duplicates,nums, return all possible subsets.Note:Elements in a subset must be in non-descending ... 阅读全文

posted @ 2015-05-20 22:01 承续缘 阅读(256) 评论(0) 推荐(0) 编辑

【Subsets】cpp
摘要:题目: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 ... 阅读全文

posted @ 2015-05-20 11:49 承续缘 阅读(239) 评论(0) 推荐(0) 编辑

【Search a 2D Matrix】cpp
摘要:题目:Write an efficient algorithm that searches for a value in anmxnmatrix. This matrix has the following properties:Integers in each row are sorted fro... 阅读全文

posted @ 2015-05-19 16:47 承续缘 阅读(182) 评论(0) 推荐(0) 编辑

【Search Insert Position 】cpp
摘要:题目: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... 阅读全文

posted @ 2015-05-19 16:22 承续缘 阅读(147) 评论(0) 推荐(0) 编辑

【Search for a Range】cpp
摘要:题目: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 ... 阅读全文

posted @ 2015-05-19 15:28 承续缘 阅读(172) 评论(0) 推荐(0) 编辑

【Sort Colors】cpp
摘要:题目: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,... 阅读全文

posted @ 2015-05-19 11:01 承续缘 阅读(200) 评论(0) 推荐(0) 编辑

【First Missing Positive】cpp
摘要:题目: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... 阅读全文

posted @ 2015-05-19 08:33 承续缘 阅读(173) 评论(0) 推荐(0) 编辑

【Sort List】cpp
摘要:题目:Sort a linked list inO(nlogn) time using constant space complexity.代码:/** * Definition for singly-linked list. * struct ListNode { * int val; *... 阅读全文

posted @ 2015-05-18 20:36 承续缘 阅读(287) 评论(0) 推荐(0) 编辑

【Insertion Sorted List】cpp
摘要:题目:Sort a linked list using insertion sort.代码:/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ... 阅读全文

posted @ 2015-05-18 20:00 承续缘 阅读(141) 评论(0) 推荐(0) 编辑

【Merge K Sorted Lists】cpp
摘要:题目:Mergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity.代码:/** * Definition for singly-linked list. * struc... 阅读全文

posted @ 2015-05-18 19:21 承续缘 阅读(168) 评论(0) 推荐(0) 编辑

【Merge Two Sorted Lists】cpp
摘要:题目: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.代码:/**... 阅读全文

posted @ 2015-05-18 14:50 承续缘 阅读(126) 评论(0) 推荐(0) 编辑

【Merge Sorted Array】cpp
摘要:题目:Given two sorted integer arraysnums1andnums2, mergenums2intonums1as one sorted array.Note:You may assume thatnums1has enough space (size that is gr... 阅读全文

posted @ 2015-05-18 14:40 承续缘 阅读(208) 评论(0) 推荐(0) 编辑

【Sum Root to Leaf Numbers】cpp
摘要:题目: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 ... 阅读全文

posted @ 2015-05-18 11:23 承续缘 阅读(225) 评论(0) 推荐(0) 编辑

【Binary Tree Maximum Path Sum】cpp
摘要:题目: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 ... 阅读全文

posted @ 2015-05-18 10:29 承续缘 阅读(159) 评论(0) 推荐(0) 编辑

【Path Sum II】cpp
摘要:题目: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... 阅读全文

posted @ 2015-05-17 22:19 承续缘 阅读(284) 评论(0) 推荐(0) 编辑

【Path Sum】cpp
摘要:题目: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... 阅读全文

posted @ 2015-05-16 23:57 承续缘 阅读(287) 评论(0) 推荐(0) 编辑

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

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

点击右上角即可分享
微信分享提示