- 博客(14)
- 资源 (1)
- 收藏
- 关注
转载 【自己动手】实现简单的C++ smart pointer
转自 http://blog.csdn.net/ruizeng88/article/details/6691191Why Smart Pointer?为什么需要智能指针?因为c++的内存管理一直是个令人头疼的问题。假如我们有如下person对象:每个person有自己的名字,并且可以告诉大家他叫什么名字:[cpp] view plai
2014-01-26 17:23:51 962
原创 Primes 质数筛法
There is a basic way to judge whether a number is a prime:int isprime(int x){ int i; float fx,sqrtx; if(x<=1) return 0; else if(x==2) return 1; else { ...
2014-01-16 22:37:17 1486
转载 DP for bombs
There are n bombs in a big circle,and each bomb has a value and a 'effect range'.If you detonated a bomb,you will get this bomb's value,but a bomb can have effect on the neighbors which the distance
2014-01-16 19:24:39 876
转载 Java集合类ArrayList循环中删除特定元素
适合各种集合类的删除:在项目开发中,我们可能往往需要动态的删除ArrayList中的一些元素。一种错误的方式:[java] view plaincopyfor(int i = 0 , len= list.size();i if(list.get(i)==XXX){ list.remove(i);
2014-01-16 17:46:12 673
原创 CareerCup Eliminate all ‘b’ and ‘ac’ in an array of characters
Eliminate all ‘b’ and ‘ac’ in an array of characters, you have to replace them in-place, and you are only allowed to iterate over the char array once.Examples:abc -> acac->''rbact->rt--...
2014-01-14 19:22:52 808
原创 CareerCup Find the biggest interval that has all its members in list in O(n)
Given a list of integers, find out the biggest interval that has all its members in the given list. e.g. given list 1, 7, 4, 6, 3, 10, 2 then answer would be [1, 4]. Develop algorithm and write code
2014-01-14 18:40:53 992
转载 CareerCup Rearrange an array using swap with 0
Rearrange an array using swap with 0. You have two arrays src, tgt, containing two permutations of the numbers 0..n-1. You would like to rearrange src so that it equals tgt. The only allowed opera
2014-01-12 09:08:44 1385
转载 CareerCup 2^i * 3^j * 5^k * 7^l
Given an equation in the form 2^i * 3^j * 5^k * 7^l where i,j,k,l >=0 are integers.write a program to generate numbers from that equation in sorted order efficiently. for example numbers from that
2014-01-11 21:27:36 2733 1
转载 CareerCup the maximum longest continous sequence of 0s
Given a binary representation of an integer say 15 as 1111, find the maximum longest continous sequence of 0s. The twist is it needs to be done in log N. I could think of O(N) solution. but couldn't g...
2014-01-11 21:01:02 805
转载 CareerCup Sort an array in a special way
Give you an array which has n integers,it has both positive and negative integers.Now you need sort this array in a special way.After that,the negative integers should in the front,and the positive in
2014-01-10 23:29:48 1157
转载 CarreerCup Sort Height
You are given two array, first array contain integer which represent heights of persons and second array contain how many persons in front of him are standing who are greater than him in term of heigh
2014-01-08 17:11:51 1047
原创 CareerCup Find the smallest range that includes at least one number from each of the k sorted lists.
You have k lists of sorted integers. Find the smallest range that includes at least one number from each of the k lists.For example,List 1: [4, 10, 15, 24, 26]List 2: [0, 9, 12, 20]List 3: [5,...
2014-01-08 16:24:49 1168
转载 CareerCup Pots of gold game:看谁拿的钱多
问题描述:Pots of gold game: Two players A & B. There are pots of gold arranged in a line, each containing some gold coins (the players can see how many coins are there in each gold pot - perfect in...
2014-01-08 15:54:32 844
转载 几个大数据的问题
2、搜索引擎会通过日志文件把用户每次检索使用的所有检索串都记录下来,每个查询串的长度为1-255字节。 假设目前有一千万个记录(这些查询串的重复度比较高,虽然总数是1千万,但如果除去重复后,不超过3百万个。一个查询串的重复度越高,说明查询它的用户越多,也就是越热门。),请你统计最热门的10个查询串,要求使用的内存不能超过1G。 典型的Top K算法,还是在这篇文章里头有所阐
2014-01-01 17:41:48 624
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人