上一页 1 ··· 17 18 19 20 21 22 23 24 25 ··· 33 下一页
摘要: Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight). For example, the 32-bit 阅读全文
posted @ 2016-02-25 19:14 周洋 阅读(132) 评论(0) 推荐(0) 编辑
摘要: Given an integer, write a function to determine if it is a power of three. Follow up:Could you do it without using any loop / recursion? //cmath里内置的有关 阅读全文
posted @ 2016-02-25 17:25 周洋 阅读(178) 评论(0) 推荐(0) 编辑
摘要: Given an integer, write a function to determine if it is a power of two. 题解:一次一次除2来做的话,效率低。所以使用位运算的方法(左移一位相当于原数乘2)列出在int范围内的所有2的倍数,然后和n异或如果等于0,那么n就是它( 阅读全文
posted @ 2016-02-25 15:47 周洋 阅读(265) 评论(0) 推荐(0) 编辑
摘要: Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. For example,Given nums = [0, 1, 阅读全文
posted @ 2016-02-25 12:41 周洋 阅读(220) 评论(0) 推荐(0) 编辑
摘要: A peak element is an element that is greater than its neighbors. Given an input array where num[i] ≠ num[i+1], find a peak element and return its inde 阅读全文
posted @ 2016-02-25 12:18 周洋 阅读(179) 评论(0) 推荐(0) 编辑
摘要: Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in or 阅读全文
posted @ 2016-02-25 10:58 周洋 阅读(167) 评论(0) 推荐(0) 编辑
摘要: Search for a Range Given a sorted array of integers, find the starting and ending position of a given target value. Your algorithm's runtime complexit 阅读全文
posted @ 2016-02-25 10:53 周洋 阅读(254) 评论(0) 推荐(0) 编辑
摘要: 1.函数本身可以赋值给变量(即变量可以指向函数)。而其实函数名本身就是指向函数的变量。 2.一个函数可以接受另一个函数作为参数。这种函数称为高阶函数。 def add(a,b,f) return f(a)+f(b) 3.map和reduce map函数接收两个参数,一个是函数,一个是Iterable 阅读全文
posted @ 2016-02-24 17:16 周洋 阅读(394) 评论(0) 推荐(0) 编辑
摘要: “apt-get”命令,这是用于管理已安装程序的通用命令。 安装:apt-get install name 卸载:apt-get remove name 卸载并清除配置:apt-get --purge remove name 更新信息库:apt-get update 系统升级:apt-get upg 阅读全文
posted @ 2016-02-22 22:47 周洋 阅读(2503) 评论(0) 推荐(0) 编辑
摘要: 1.vector::pop_back() 删除vector的最后一个元素,vector的大小减一,删了的元素被销毁。 2.vector::erase() iterator erase (iterator position); iterator erase (iterator first, itera 阅读全文
posted @ 2016-02-03 21:44 周洋 阅读(6876) 评论(0) 推荐(0) 编辑
上一页 1 ··· 17 18 19 20 21 22 23 24 25 ··· 33 下一页