上一页 1 ··· 14 15 16 17 18 19 20 21 22 ··· 30 下一页

2017年12月26日

Next Permutation 下一个排列

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

posted @ 2017-12-26 21:24 夜的第八章 阅读(137) 评论(0) 推荐(0) 编辑

search in rotated sorted array

摘要: Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). You a 阅读全文

posted @ 2017-12-26 19:41 夜的第八章 阅读(136) 评论(0) 推荐(0) 编辑

valid sudoku(数独)

摘要: Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules. The Sudoku board could be partially filled, where empty cells are filled wit 阅读全文

posted @ 2017-12-26 17:09 夜的第八章 阅读(248) 评论(0) 推荐(0) 编辑

combination sum II

摘要: Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T. Each num 阅读全文

posted @ 2017-12-26 13:17 夜的第八章 阅读(151) 评论(0) 推荐(0) 编辑

Combination sum

摘要: Given a set of candidate numbers (C) (without duplicates) and a target number (T), find all unique combinations in C where the candidate numbers sums 阅读全文

posted @ 2017-12-26 11:01 夜的第八章 阅读(160) 评论(0) 推荐(0) 编辑

2017年12月25日

Swap Nodes in Pairs(交换节点)

摘要: Given a linked list, swap every two adjacent nodes and return its head. For example,Given 1->2->3->4, you should return the list as 2->1->4->3. Your a 阅读全文

posted @ 2017-12-25 21:34 夜的第八章 阅读(207) 评论(0) 推荐(0) 编辑

4 sum

摘要: Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array whic 阅读全文

posted @ 2017-12-25 19:54 夜的第八章 阅读(229) 评论(0) 推荐(0) 编辑

3 sum closest

摘要: Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. 阅读全文

posted @ 2017-12-25 15:53 夜的第八章 阅读(176) 评论(0) 推荐(0) 编辑

五大常用算法:分治、动态规划、贪心、回溯和分支界定

摘要: 分治算法 一、基本概念 在计算机科学中,分治法是一种很重要的算法。字面上的解释是“分而治之”,就是把一个复杂的问题分成两个或更多的相同或相似的子问题,再把子问题分成更小的子问题……直到最后子问题可以简单的直接求解,原问题的解即子问题的解的合并。这个技巧是很多高效算法的基础,如排序算法(快速排序,归并 阅读全文

posted @ 2017-12-25 10:22 夜的第八章 阅读(504) 评论(0) 推荐(0) 编辑

2017年12月24日

3sum(从数组中找出三个数的和为0)

摘要: Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of 阅读全文

posted @ 2017-12-24 21:34 夜的第八章 阅读(1621) 评论(0) 推荐(0) 编辑

上一页 1 ··· 14 15 16 17 18 19 20 21 22 ··· 30 下一页

导航