这个题,用的递归 从根节点开始,每路过一个节点,就把从根节点到该节点所有节点值累加起来存入关联容器,假设当前累加至了cur,而cur-target存在于关联容器中,则累加和为cur-target那个节点到当前节点之间的节点值打得和为目标值,此时将计数器增加。 应该注意的是每次递归函数执行完成返回上一 ...
分类:
其他好文 时间:
2018-05-28 21:11:38
阅读次数:
128
import ( "bytes" "encoding/binary" "encoding/gob" "fmt" ) func str_to_byte(src string) []byte { //strSlice := []string{src} buffer := &bytes.Buffer{} ...
分类:
其他好文 时间:
2018-05-28 18:57:33
阅读次数:
166
int binary_search(const vector& stones,int val){ int sz=stones.size(); int l=0,r=sz-1; while(l>1; if(stones[mid]>=val){ r=mid-1; }else{ l=mid+1; ... ...
分类:
其他好文 时间:
2018-05-27 20:28:57
阅读次数:
145
Binary Indexed Tree 空间复杂度O(N),查询时间复杂度O(lgN). 其中每个元素,存储的是数组中一段的和。 ...
分类:
其他好文 时间:
2018-05-27 17:18:52
阅读次数:
182
题意:有障碍物的多回路的插头dp,求方案数 题解:其实搞懂插头dp的插头方式就和轮廓线dp一样了,因为这题是多回路,不需要单回路的连通性;‘ dp[i][j]表示第i行j状态的方案数 需要注意的是第二维我们维护了m+1个状态,因为对于插头可能会有m+1种情况,对于每一个位置有插头就是1,否则就是0 ...
分类:
其他好文 时间:
2018-05-27 13:51:45
阅读次数:
128
小白觉得springboot打成jar包直接使用内嵌的tomcat或jetty容器(java -jar xxx.jar)运行项目不利于定位问题,我还是习惯于查看tomcat或nginx的日志来定位问题,今天小白就讲讲springboot打成war部署JavaWeb项目于tomcat。 新建web项目 ...
分类:
编程语言 时间:
2018-05-26 18:48:11
阅读次数:
430
本片文章主要是对pickle官网的阅读记录。 The pickle module implements binary protocols for serializing and de-serializing a Python object structure. “Pickling” is the p ...
分类:
编程语言 时间:
2018-05-26 13:59:09
阅读次数:
308
代码是网上抄的,自己练练手 RSA加密 package com.answern.openplatform; import org.apache.commons.codec.binary.Base64; import org.junit.Test; import javax.crypto.Cipher ...
分类:
其他好文 时间:
2018-05-25 19:27:00
阅读次数:
202
表类型 protobuf语言的maps字段类型相当于C++语言的std::map类型 工程目录结构 proto文件 读写源文件 $ cat reader.cpp include include include "sample_maps.pb.h" using namespace std; int m ...
分类:
其他好文 时间:
2018-05-25 13:44:17
阅读次数:
145
二分法 Binary Search Given a sorted integer array - nums, and an integer - target, find the any/first/last position of target in nums. Return -1 if targe ...
分类:
其他好文 时间:
2018-05-25 01:37:00
阅读次数:
156