摘要:
Given a range [m, n] where 0 >=1; 9 n>>=1;10 }11 return res;12 }13 14 int bitvalue(int m, int n) {15 i... 阅读全文
摘要:
Given a 2d grid map of'1's (land) and'0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent ... 阅读全文
摘要:
You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping yo... 阅读全文
摘要:
题目2 : Professor Q's Software时间限制:10000ms单点时限:1000ms内存限制:256MB描述Professor Q develops a new software. The software consists of N modules which are numbe... 阅读全文
摘要:
lower_boundlower_bound(begin, end, target)用来查找一个已排序的序列中[begin, end)第一个大于等于target的元素index。数组A如下:value: 1, 2, 2, 3, 4, 5, 5, 6, 7index: 0, 1, 2, 3, 4, 5... 阅读全文
摘要:
class Solution {public: int findMin(vector &num) { int L = 0, R = num.size() - 1; while (L = num[R]) { int mid= (L+R)/2; ... 阅读全文
摘要:
Java世界的繁荣反射这一特性有很大功劳,可以获取全面的类型信息。/** * */package ref;import java.lang.reflect.Field;import java.lang.reflect.InvocationHandler;import java.lang.refle... 阅读全文
摘要:
看Thinking in Java中内部类的一章,有内部类和静态内部类,书中把后者叫做嵌套类。常见用法实例:一般内部类(非静态) 1 public class InnerClassTest { 2 public static void main(final String args[]) { ... 阅读全文
摘要:
练习一发,主要是使用placement new在原始内存上创建对象。半路md面试电话来了,赶紧存档,看Java大法#include #include #include #include using namespace std;class Object {public: static int c... 阅读全文
摘要:
要求是不使用sizeof,一开始写了个看似可以,但是有问题的方法:long* a = NULL;long* b = a + 1;int n = (char*)b - (char*)a;这个方法等价于sizeof(long),但这其实有问题,在32位编译器上编译得到的代码在64位机器上得到的结果还是n... 阅读全文