上一页 1 2 3 4 5 6 ··· 15 下一页
摘要: 动态规划: 1、状态定义 2、状态初始化 3、状态转移 /* */ #include<stdio.h> #include<malloc.h> #include<string.h> #include<stdlib.h> #include<math.h> #include<string.h> #incl 阅读全文
posted @ 2020-04-22 08:29 dreamy_java 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 动态规划 /* */ #include<stdio.h> #include<malloc.h> #include<string.h> #include<stdlib.h> #include<math.h> #include<string.h> #include<iostream> int getMi 阅读全文
posted @ 2020-04-21 17:14 dreamy_java 阅读(124) 评论(0) 推荐(0) 编辑
摘要: 解决方法:动态规划。 int uniquePaths(int m, int n){ //1、状态定义 int **dp=(int**)malloc(sizeof(int*)*n),i,j; for(i=0;i<n;i++){ dp[i]=(int*)malloc(sizeof(int)*m); } 阅读全文
posted @ 2020-04-18 11:47 dreamy_java 阅读(87) 评论(0) 推荐(0) 编辑
摘要: int compare(const void *a,const void *b){ return *(int*)a>*(int*)b; } int **merge(int **intervals, int intervalsSize, int *intervalsColSize, int *retu 阅读全文
posted @ 2020-04-17 11:30 dreamy_java 阅读(256) 评论(0) 推荐(0) 编辑
摘要: /* 最大子序和。 动态规划: 1、状态定义 2、状态初始化 3、状态转移 */ #include<stdio.h> #include<malloc.h> #include<string.h> #include<stdlib.h> #include<math.h> #include<string.h 阅读全文
posted @ 2020-04-09 16:10 dreamy_java 阅读(261) 评论(0) 推荐(0) 编辑
摘要: 组合总和。 给定一个无重复元素的数组 candidates 和一个目标数 target ,找出 candidates 中所有可以使数字和为 target 的组合。 例: candidates = [2,3,6,7], target = 7, [ [7], [2,2,3] ] candidates = 阅读全文
posted @ 2020-04-05 17:34 dreamy_java 阅读(245) 评论(0) 推荐(0) 编辑
摘要: /* 34.在排序数组中查找元素的第一个和最后一个位置。 给定一个按照升序排列的整数数组 nums,和一个目标值 target。找出给定目标值在数组中的开始位置和结束位置。 你的算法时间复杂度必须是 O(log n) 级别。 如果数组中不存在目标值,返回 [-1, -1]。 */ #include< 阅读全文
posted @ 2020-04-05 11:05 dreamy_java 阅读(317) 评论(0) 推荐(0) 编辑
摘要: /* 搜索旋转排序数组--二分查找。 */ #include<stdio.h> #include<malloc.h> #include<string.h> #include<stdlib.h> #include<math.h> #include<string.h> #include <iostrea 阅读全文
posted @ 2020-04-04 12:05 dreamy_java 阅读(186) 评论(0) 推荐(0) 编辑
摘要: /* 下一个排列--看图解。 */ #include<stdio.h> #include<malloc.h> #include<string.h> #include<stdlib.h> #include<math.h> #include<string.h> #include <iostream> v 阅读全文
posted @ 2020-04-03 17:40 dreamy_java 阅读(156) 评论(0) 推荐(0) 编辑
摘要: /* 有效的括号--回溯法。 */ #include<stdio.h> #include<malloc.h> #include<string.h> #include<stdlib.h> #include<math.h> #include<string.h> #include <iostream> v 阅读全文
posted @ 2020-04-03 15:21 dreamy_java 阅读(400) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 15 下一页