Given a binary matrix A, we want to flip the image horizontally, then invert it, and return the resulting image. To flip an image horizontally means t ...
分类:
其他好文 时间:
2019-02-03 01:03:12
阅读次数:
158
比赛的时候又被垃圾题艹翻了啊。 这个题显然是区间dp 考虑怎么转移。 类似消除方块和ZYB玩字符串那样的一个DP。 可以从左到右依次考虑消除。 dp[l][r][k][flag]表示区间l,r左边粘着k个flag。 转移方式: 1.考虑强行去继续黏上下一个字符并使k+1。 2.考虑把一段跳过去,让被 ...
分类:
其他好文 时间:
2019-02-03 00:47:44
阅读次数:
214
分治最重要的思想不还是二分查找 二分查找也称折半查找(Binary Search),它是一种效率较高的查找方法。但是,折半查找要求线性表必须采用顺序存储结构,而且表中元素按关键字有序排列。 首先,假设表中元素是按升序排列,将表中间位置记录的关键字与查找关键字比较,如果两者相等,则查找成功;否则利用中 ...
分类:
其他好文 时间:
2019-02-02 20:38:07
阅读次数:
233
/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), r... ...
分类:
其他好文 时间:
2019-02-02 17:37:49
阅读次数:
171
直接下载Tez的binary包部署安装是有问题的,因为默认支持hadoop版本为2.7,2.7以上的就需要手动编译了。 1. 下载Tez源码 2. CD到源码文件夹,mvn install Dhadoop.version=3.0.3 DskipTests Dmaven.javadoc.skip=tr ...
分类:
其他好文 时间:
2019-02-02 17:26:48
阅读次数:
327
算法描述: Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as follows: The left subtree of a node contain ...
分类:
其他好文 时间:
2019-02-02 17:02:41
阅读次数:
149
JSR 规范目录 一、Servlet 规范 1.1 "Servlet 2.x 规范(一)组件介绍" 1.2 "Servlet 3.x 规范(二)注解规范和异步请求" 每天用心记录一点点。内容也许不重要,但习惯很重要! ...
分类:
Web程序 时间:
2019-02-02 12:46:08
阅读次数:
174
算法描述: The gray code is a binary numeral system where two successive values differ in only one bit. Given a non-negative integer n representing the tot ...
分类:
其他好文 时间:
2019-02-01 17:06:02
阅读次数:
164
<题目链接> 题目大意: 有一个长度为n(n<1000)的01串,该串中至少有一个0和一个1,现在由你构造出一些01串,进行询问,然后系统会给出你构造的串与原串的 Hamming distance ,现在要求你按照步骤进行交互式操作,最终得到任意一个0、1的下标。 解题分析:因为原串中至少存在一个0 ...
分类:
其他好文 时间:
2019-02-01 16:26:36
阅读次数:
142
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */... ...
分类:
其他好文 时间:
2019-02-01 14:53:37
阅读次数:
220