03 2015 档案
摘要:stoi函数默认要求输入的参数字符串是符合int范围的[-2147483648, 2147483647],否则会runtime error。atoi函数则不做范围检查,若超过int范围,则显示-2147483648(溢出下界)或者2147483647(溢出上界)。
阅读全文
摘要:Rotate ArrayRotate an array ofnelements to the right byksteps.For example, withn= 7 andk= 3, the array[1,2,3,4,5,6,7]is rotated to[5,6,7,1,2,3,4].Note...
阅读全文
摘要:Reverse BitsReverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as000000101001010000011110100111...
阅读全文
摘要:Number of 1 BitsWrite a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as theHamming weight).For exampl...
阅读全文
摘要:#include // std::cout#include // std::vectorusing namespace std;int main () { vector > theta; theta.resize(1, vector(2, 1)); thet...
阅读全文