上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 21 下一页

2016年6月13日

House Robber II

摘要: Note: This is an extension of House Robber. After robbing those houses on that street, the thief has found himself a new place for his thievery so tha 阅读全文

posted @ 2016-06-13 11:14 Sheryl Wang 阅读(103) 评论(0) 推荐(0) 编辑

House Robber

摘要: You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping yo 阅读全文

posted @ 2016-06-13 10:13 Sheryl Wang 阅读(142) 评论(0) 推荐(0) 编辑

2016年6月12日

LRU Cache

摘要: 这是一道非常高频,非常经典的题目: 首先分析下题意: Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get  阅读全文

posted @ 2016-06-12 21:22 Sheryl Wang 阅读(129) 评论(0) 推荐(0) 编辑

Topological Sorting

摘要: 给定一个有向图,图节点的拓扑排序被定义为: 对于每条有向边A--> B,则A必须排在B之前 拓扑排序的第一个节点可以是任何在图中没有其他节点指向它的节点 找到给定图的任一拓扑排序. 拓扑排序一共有两种解法: 1.是kahn’s algorithm 2.DFS的做法(按结束顺序倒过来放入L中) kah 阅读全文

posted @ 2016-06-12 16:34 Sheryl Wang 阅读(211) 评论(0) 推荐(0) 编辑

2016年6月11日

Number of Islands II

摘要: Given a n,m which means the row and column of the 2D matrix and an array of pair A( size k). Originally, the 2D matrix is all 0 which means there is o 阅读全文

posted @ 2016-06-11 21:44 Sheryl Wang 阅读(161) 评论(0) 推荐(0) 编辑

2016年6月9日

Subarray Sum Closet

摘要: Given an integer array, find a subarray with sum closest to zero. Return the indexes of the first number and last number. Given [-3, 1, 1, -3, 5], ret 阅读全文

posted @ 2016-06-09 21:14 Sheryl Wang 阅读(249) 评论(0) 推荐(0) 编辑

2016年6月7日

Next Permutation

摘要: Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not possib 阅读全文

posted @ 2016-06-07 22:06 Sheryl Wang 阅读(159) 评论(0) 推荐(0) 编辑

Permutation Sequence

摘要: The set [1,2,3,…,n] contains a total of n! unique permutations. By listing and labeling all of the permutations in order,We get the following sequence 阅读全文

posted @ 2016-06-07 19:32 Sheryl Wang 阅读(111) 评论(0) 推荐(0) 编辑

Permutations II

摘要: Given a collection of numbers that might contain duplicates, return all possible unique permutations. For example,[1,1,2] have the following unique pe 阅读全文

posted @ 2016-06-07 15:19 Sheryl Wang 阅读(141) 评论(0) 推荐(0) 编辑

Permutations

摘要: Given a collection of distinct numbers, return all possible permutations. For example, [1,2,3] have the following permutations: 终于开始做回溯的题目了,其实这是一道枚举的题 阅读全文

posted @ 2016-06-07 10:35 Sheryl Wang 阅读(305) 评论(0) 推荐(0) 编辑

上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 21 下一页

导航