上一页 1 2 3 4 5 6 ··· 22 下一页
摘要: 一. leetcode题目链接 https://leetcode-cn.com/problems/longest-palindromic-subsequence/ 二. 动态规划 (1) 如果一个字符串S[0,1,2,3,,,n-1],S[0] == S[n-1]那么最大回文子序列就是 P(left 阅读全文
posted @ 2019-10-07 21:19 式微胡不归 阅读(270) 评论(0) 推荐(0) 编辑
摘要: 一. 题目描述: https://leetcode-cn.com/problems/longest-common-subsequence/ 二. 动态规划解法 例如:s1="abcde" s2= "ace",求两个字符串的公共子序列,答案是“ace” 1. S{s1,s2,s3....si} T{t 阅读全文
posted @ 2019-10-07 09:30 式微胡不归 阅读(209) 评论(0) 推荐(0) 编辑
摘要: 正数的补码是自己本身 负数的补码是,先取反码(首尾不反),然后+1 2. 在Go语言中 ^0表示对0取反 我们假如是4位代表一个数字的话,最高位是符号位 0在计算机中用补码的形式存在是 : 0000 取反得到 :1111 (是-1在计算机中以补码的形式存在,所以^0 就是 -1) 所以 ^1 就是 阅读全文
posted @ 2019-10-05 17:19 式微胡不归 阅读(9177) 评论(0) 推荐(0) 编辑
摘要: 参考答案,特别鸣谢:https://leetcode-cn.com/problems/min-cost-climbing-stairs/solution/scala-dong-tai-gui-hua-di-gui-by-zx233/ 0. 题目描述 数组的每个索引做为一个阶梯,第 i个阶梯对应着一个 阅读全文
posted @ 2019-10-05 10:36 式微胡不归 阅读(279) 评论(0) 推荐(0) 编辑
摘要: http://www.wowotech.net/process_management/447.html 阅读全文
posted @ 2019-09-29 17:02 式微胡不归 阅读(146) 评论(0) 推荐(0) 编辑
摘要: func sortList(head *ListNode) *ListNode { slist(head,nil) return head } func slist(head *ListNode,tail *ListNode){ if head == nil || head.Next == nil || head == tail{ return } pivot := head.Val i := h 阅读全文
posted @ 2019-09-25 17:15 式微胡不归 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 一共两个函数 find() 查找根节点 union() 合并两个集合 根据树的高度合并两集合 定义一个rank[]数组,存储两个树的高度,比如rank[xroot] = 3 如果rank[xRoot] > rank{yRoot]的时候,就是x那个树比y那个树要高,所以合并的时候将y那个树的根节点给连 阅读全文
posted @ 2019-09-24 21:36 式微胡不归 阅读(161) 评论(0) 推荐(0) 编辑
摘要: java 阅读全文
posted @ 2019-09-23 09:06 式微胡不归 阅读(133) 评论(0) 推荐(0) 编辑
摘要: ZERO. 数组 1. 创建 一个不固定大小的数组 var array [] int 2. 遍历 var nums1 = []int {1,6,7} 一. Map 1. 创建map var m = make(map[int]int) //第一个int为key,第二个int不加中括号为val 2. 添 阅读全文
posted @ 2019-09-20 19:49 式微胡不归 阅读(224) 评论(0) 推荐(0) 编辑
摘要: func quickSort(nums []int,left int,right int ){ if left < right { p := park(nums,left,right) quickSort(nums,left,p-1) quickSort(nums,p+1,right) } } func park(nums ... 阅读全文
posted @ 2019-09-20 19:12 式微胡不归 阅读(115) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 22 下一页