摘要: public class Solution { //public int MaxArea(int[] height) //{ // var max = 0; // for (int i = 0; i < height.Length; i++) // { // for (int j = 0; j < 阅读全文
posted @ 2018-10-04 21:42 Sempron2800+ 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 本题使用回溯法,深度优先搜索。使用隐式条件来进行加速。 补充一个使用动态规划的方法,使用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) 编辑