上一页 1 ··· 78 79 80 81 82 83 84 85 86 ··· 114 下一页
摘要: 本题使用回溯法,深度优先搜索。使用隐式条件来进行加速。 补充一个使用动态规划的方法,使用python实现,但是效率不是很高: 思路分析:双层循环,时间复杂度是O(n^2)。 dp[i]表示在nums中,以nums[i]为结尾的自增子序列的长度。 第13行是在外层循环,每次循环结束的时候更新,全局的最 阅读全文
posted @ 2018-10-04 19:49 Sempron2800+ 阅读(183) 评论(0) 推荐(0) 编辑
摘要: public class Solution { public bool SearchMatrix(int[,] matrix, int target) { int i = 0, j = matrix.GetLength(1) - 1; while (i = 0) { ... 阅读全文
posted @ 2018-10-04 15:57 Sempron2800+ 阅读(103) 评论(0) 推荐(0) 编辑
摘要: 补充一个python实现: 阅读全文
posted @ 2018-10-04 14:48 Sempron2800+ 阅读(111) 评论(0) 推荐(0) 编辑
摘要: public class Solution { public bool IsValidSudoku(char[,] board) { for (int i = 0; i (); for (int j = 0; j (); for (int i = 0; i (); ... 阅读全文
posted @ 2018-10-04 14:18 Sempron2800+ 阅读(100) 评论(0) 推荐(0) 编辑
摘要: public class Solution { public void GameOfLife(int[][] board) { var row = board.GetLength(0) - 1; var col = board[0].GetLength(0) - 1; var list... 阅读全文
posted @ 2018-10-04 11:44 Sempron2800+ 阅读(116) 评论(0) 推荐(0) 编辑
摘要: 补充一个python的实现,使用二分查找: 阅读全文
posted @ 2018-10-03 20:07 Sempron2800+ 阅读(104) 评论(0) 推荐(0) 编辑
摘要: 上面这个太弱了,给一个强不了多少的 下面给出一个比较强的 注意swap的写法,如果用temp来存,速度会慢很多。 阅读全文
posted @ 2018-10-03 19:45 Sempron2800+ 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 数据结构设计问题,从网上找的参考答案。 根据以上的思路,写了一份python版本的代码: 阅读全文
posted @ 2018-10-03 19:37 Sempron2800+ 阅读(105) 评论(0) 推荐(0) 编辑
摘要: public class Solution { public IList> GroupAnagrams(string[] strs) { var L = new List>(); var T = new List>(); for (var i = 0; i (); ... 阅读全文
posted @ 2018-10-03 19:08 Sempron2800+ 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 补充python的实现,使用堆排序: 阅读全文
posted @ 2018-10-03 16:42 Sempron2800+ 阅读(138) 评论(0) 推荐(0) 编辑
上一页 1 ··· 78 79 80 81 82 83 84 85 86 ··· 114 下一页