摘要:
Source Given two 32-bit numbers, N and M, and two bit positions, i and j. Write a method to set all bits between i and j in N equal to M (e g , M beco 阅读全文
摘要:
Source Given n, how many structurally unique BSTs (binary search trees) that store values 1...n? Example Given n = 3, there are a total of 5 unique BS 阅读全文
摘要:
Source Write an algorithm which computes the number of trailing zeros in n factorial. Example 11! = 39916800, so the out should be 2 Challenge O(log N 阅读全文
摘要:
Source Determine the number of bits required to convert integer A to integer B Example Given n = 31, m = 14,return 2 (31)10=(11111)2 (14)10=(01110)2 题 阅读全文
摘要:
Source Using O(1) time to check whether an integer n is a power of 2. Example For n=4, return true; For n=5, return false; Challenge O(1) time 题解 咋看起来 阅读全文
摘要:
一、区别 1、传输协议 RPC,可以基于TCP协议,也可以基于HTTP协议 HTTP,基于HTTP协议 2、传输效率 RPC,使用自定义的TCP协议,可以让请求报⽂体积更小,或者使用HTTP2协议,也可以很好的减少报文的体积,提高传输效率 HTTP,如果是基于HTTP1.1的协议,请求中会包含很多无 阅读全文
摘要:
DER格式的密钥转PEM PEM格式的密钥就是用DER格式的数据用base64进行编码后,然后在前后加上 “ BEGIN PUBLIC KEY ” 和 “ END PUBLIC KEY ” PHP 十进制DER数据转换 $derData = 'XXXXXXXXXXXXXXXXXXXX'; $pemD 阅读全文
摘要:
背景 最近在对接建行的支付,我们做的是被扫支付,就是B扫C,一开始对方发了一个压缩包给我,看起来挺齐全的,文档、demo啥的都有,以为很简单,跟微信支付宝类似,调一下接口,验证一下就OK了。然而,事实证明我还是太年轻了。而且网络上你能够搜到的基本上都用不了,所以记一下博客,或许可以帮助其他人。 先说 阅读全文
摘要:
Source Given 2*n + 2 numbers, every numbers occurs twice except two, find them. Example Given [1,2,2,3,4,4,5,3] return 1 and 5 Challenge O(n) time, O( 阅读全文
摘要:
Source Given 3*n + 1 numbers, every numbers occurs triple times except one, find it. Example Given [1,1,2,3,3,3,2,2,4,1] return 4 Challenge One-pass, 阅读全文