https://leetcode.com/problems/add-binary/#/description 思路是把问题泛化成一个二进制carry 上浮的操作。比如从最低位开始,设置一个进位值,比如3,然后按照二进制的法则对这个carry 进行进位操作,既从低位到高位依次上浮,直到carry 为0 ...
分类:
其他好文 时间:
2017-06-01 18:35:25
阅读次数:
131
// 二分查找法,在有序数组arr中,查找target// 如果找到target,返回相应的索引index// 如果没有找到target,返回-1template<typename T>int binarySearch(T arr[], int n, T target){ // 在arr[l...r ...
分类:
其他好文 时间:
2017-06-01 13:23:30
阅读次数:
158
之前使用SQL把十进制的整数转换为三十六进制,SQL代码请参考:SQL Server 进制转换函数,其实它是基于二、八、十、十六进制转换的计算公式的,进制之间的转换是很基础的知识,但是我发现网络上没有一篇能把它说的清晰、简单、易懂的文章,所以我才写这篇文章的念头,希望能让你再也不用担心、害怕进制之间 ...
分类:
其他好文 时间:
2017-05-31 23:09:08
阅读次数:
261
Given a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and return its area.For example, given the following matr ...
分类:
其他好文 时间:
2017-05-31 22:17:52
阅读次数:
264
给定两个数组:arr1[0..m-1]和arr2[0..n-1]. 推断arr2[]是否为arr1[]的子集。这两个数组都是无序的。 比如: 输入: arr1[] = {11, 1, 13, 21, 3, 7}, arr2[] = {11, 3, 7, 1} 输出: arr2是arr1的子集。 输入 ...
分类:
编程语言 时间:
2017-05-31 19:09:24
阅读次数:
276
本章目录:12.21FTP下载文件#!/bin/bash
if[$#-ne1];then
echo"Usage:$0filename"
fi
dir=$(dirname$1)
file=$(basename$1)
ftp-n-v<<EOF#-n自动登录
open192.168.1.10
useradminadminpass
binary#设置ftp传输模式为二进制,避免MD5值不同或.tar.gz压缩包格式错误
cd$dir..
分类:
系统相关 时间:
2017-05-31 15:27:51
阅读次数:
387
# -*- coding: utf-8 -*- import gensim # 导入模型 model = gensim.models.KeyedVectors.load_word2vec_format('vectors.bin', binary=True) # 得到两组词的相似度 list1 = [... ...
分类:
其他好文 时间:
2017-05-31 12:10:24
阅读次数:
798
/** * Definition of TreeNode: * public class TreeNode { * public int val; * public TreeNode left, right; * public TreeNode(int val) { * this.val = val... ...
分类:
其他好文 时间:
2017-05-31 10:29:40
阅读次数:
169
This question is a little bit harder than the Max Depth. We only compare the depth of the leaf node. If it is missing one side, this level shouldn't b ...
分类:
其他好文 时间:
2017-05-31 10:14:30
阅读次数:
254
Note:a balaced tree needs to be balaced all the time. So it is important remember the status of each subtree. If it is not balaced in the middle, the ...
分类:
其他好文 时间:
2017-05-31 10:14:05
阅读次数:
151