Loading [MathJax]/jax/element/mml/optable/SuppMathOperators.js

04 2018 档案

摘要:思路:设dp[i][j] 为i到j内回文子串的个数。先枚举所有字符串区间。再依据容斥原理。 那么状态转移方程为 dp[i][j] = dp[i][j-1] + dp[i+1][j] - dp[i+1][j-1] 如果 a[i] = a[j] , dp[i][j] += (dp[i+1][j-1] + 阅读全文
posted @ 2018-04-16 14:09 Vincent丶丶 阅读(698) 评论(0) 推荐(0) 编辑
摘要:算法 1 设半径为Rx=rcos(θ) y=rsin(θ) 其中 0t为0-1均匀分布产生的随机数,r = sqrt(t) \ast R,$\theta = 2\pi \a 阅读全文
posted @ 2018-04-15 19:58 Vincent丶丶 阅读(3721) 评论(0) 推荐(0) 编辑
摘要:Given a (singly) linked list with head node root, write a function to split the linked list into k consecutive linked list "parts". The length of each 阅读全文
posted @ 2018-04-15 11:05 Vincent丶丶 阅读(151) 评论(0) 推荐(0) 编辑
摘要:You are given two non-empty linked lists representing two non-negative integers. The most significant digit comes first and each of their nodes contai 阅读全文
posted @ 2018-04-15 10:25 Vincent丶丶 阅读(173) 评论(0) 推荐(0) 编辑
摘要:You are given a binary tree in which each node contains an integer value. Find the number of paths that sum to a given value. The path does not need t 阅读全文
posted @ 2018-04-14 21:53 Vincent丶丶 阅读(178) 评论(0) 推荐(0) 编辑
摘要:Given a complete binary tree, count the number of nodes. Definition of a complete binary tree from Wikipedia:In a complete binary tree every level, ex 阅读全文
posted @ 2018-04-14 19:02 Vincent丶丶 阅读(137) 评论(0) 推荐(0) 编辑
摘要:Given a binary tree, find the maximum path sum. For this problem, a path is defined as any sequence of nodes from some starting node to any node in th 阅读全文
posted @ 2018-04-14 15:24 Vincent丶丶 阅读(158) 评论(0) 推荐(0) 编辑
摘要:Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number. An example is the root-to-leaf path 1->2->3 whic 阅读全文
posted @ 2018-04-14 14:48 Vincent丶丶 阅读(163) 评论(0) 推荐(0) 编辑
摘要:Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum. For example:Given the below binary tree and sum 阅读全文
posted @ 2018-04-14 10:32 Vincent丶丶 阅读(164) 评论(0) 推荐(0) 编辑
摘要:Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. F 阅读全文
posted @ 2018-04-14 10:02 Vincent丶丶 阅读(138) 评论(0) 推荐(0) 编辑
摘要:一、简介 设h(0)=1h(1)=1,Catalan数满足递推式 h(n) = h(0) \ast h(n-1) + h(1)\ast h(n-2) + \cdots + h(n-1)\ast h(0)  等价递推式: h(n) = C_{2n}^{n} / (n + 1),$ ( 阅读全文
posted @ 2018-04-13 22:10 Vincent丶丶 阅读(186) 评论(0) 推荐(0) 编辑
摘要:一、 贪心法就是遵循某种规则,不断贪心地选取当前最优策略的算法设计方法。 二、 1.硬币问题 有1元、5元、10元、50元、100元、500元的硬币各C_{1}C_{5}C_{10}C_{50}C_{100}C_{500} 枚。现在要用这些硬币来支付A元,最少 阅读全文
posted @ 2018-04-03 22:28 Vincent丶丶 阅读(1165) 评论(0) 推荐(0) 编辑
摘要:一、深度优先搜索 POJ No.2386 Lake Counting Description Due to recent rains, water has pooled in various places in Farmer John's field, which is represented by 阅读全文
posted @ 2018-04-03 21:42 Vincent丶丶 阅读(431) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示