a java solution:
import java.util.*;
public class FindNonDupeSubTree {
private class Node{
int val;
Node left;
Node right;
Node (int val){
this.val = val;
left = null;
right = null;
}
}
public boolean FindSubTree(Node root, Set nodeSet, ArrayList<
Integer> validTreeRoots){
if (root == null)
return true;
Set sleft = new HashSet();
Set ... 阅读全帖
运气不好,碰到老印三哥三姐,悲剧了。电话进来Late了。然后讨论简历。。。
上题,头有点晕。。。把题弄错了。一开始思路不对,就悲剧了。
Given a list of child->parent relationships, build a binary tree out of it.
All the element Ids inside the tree are unique.
Example:
Given the following relationships:
Child Parent IsLeft
15 20 true
19 80 true
17 20 false
16 80 false
80 50 false
50 null false
20 50 true
You should return the following tree:
50
/
20 80
/ /
15 17 19 16
Function S... 阅读全帖
FG以前都面过的题目,貌似出现概率不低。搜索+论坛考古之后实在没有研究出满意的
答案,
原题如下:
Given API:
int Read4096(char* buf);
It reads data from a file and records the position so that the next time
when it is called it reads the next 4k chars (or the rest of the file,
whichever is smaller) from the file.
The return is the number of chars read.
Todo: Use above API to Implement API
"int Read(char* buf, int n)" which reads any number of chars from the file.
有没有大牛甩个python解法
FG以前都面过的题目,貌似出现概率不低。搜索+论坛考古之后实在没有研究出满意的
答案,
原题如下:
Given API:
int Read4096(char* buf);
It reads data from a file and records the position so that the next time
when it is called it reads the next 4k chars (or the rest of the file,
whichever is smaller) from the file.
The return is the number of chars read.
Todo: Use above API to Implement API
"int Read(char* buf, int n)" which reads any number of chars from the file.
有没有大牛甩个python解法
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.atomic.AtomicInteger;
public class H2O {
//using blocking queue, so it's easy to just have 2 h and 1 o at most,
//other threads will be blocked.
ArrayBlockingQueue
简单写了一下
用 java,思路是flooding
按照楼主原文4是答案,所以不能平移
我英文注释说,growing sea level, when oceans become one body, any elements
adjacent to water ( not checked in the above) are the answers.
对于basin,水出不去的地方,思路有,flood 到的时候,设成无限高(closed).
这题折腾不知道有什么意义没有,有什么数学或图形学上的理论吗?或者在计算机图形
图象上有什么应用?
所以不想花更多时间
上贴还有TODO没有完工。
大家愿加test case非常欢迎
也可以直接拉我github 上code
import java.util.*;
public class DesignDataStructure {
Map> map = new HashMap>();
List list = new ArrayList();
public void add(int num){
list.add(num);
int index=list.size()-1;
if(map.containsKey(num)){
map.get(num).add(index);
}else{
Set set =new HashSet();
set.add(index);
map.put(num, set);
}
}
public voi... 阅读全帖
import java.util.*;
public class DesignDataStructure {
Map> map = new HashMap>();
List list = new ArrayList();
public void add(int num){
list.add(num);
int index=list.size()-1;
if(map.containsKey(num)){
map.get(num).add(index);
}else{
Set set =new HashSet();
set.add(index);
map.put(num, set);
}
}
public voi... 阅读全帖
对啊,写perf的时候就有: todo list 上有:
april 20: Work with your manager to set your performance expectations for
the next 6 months
当时没注意,今天仔细看了一下
这个是每个人个人的perf上都有?求确认谢谢了
你重复两遍"has nothing todo"就不需要任何论证了吗?
Abigail Fisher一案中支持种族录取制度的大法官的四位都是自由派大法官,譬如这次
obama提名的sotomayor.反对的都是保守派大法官,譬如写下名句“The way to stop
discrimination on the basis of race is to stop discriminating on the basis
of race' 的大法官John G. Roberts就是由布什提名的。
这一届总统非常非常重要是因为,有四名大法官高龄了。这届总统很可能有机会提名四
位大法官。四位大法官对美国的政治走向可以影响长达几十年。
关于左右派别和共产主义的联系,我就不和你详细探讨了。你收回你的光辉名句“所有
美国医学院都是私立的“先。
Please read this instuction if you haven't finish your J wiaver and you want
todo in the future. Also I added it in Top 6 post. Everyone can read it
anytime.
haha.
Well, it is not sad at all. Not able to make money, to me, is SAD.
There is nothing wrong with tech, on the contrary, it gives you a leg where
you could make good money from being a good tech guy.
俺觉得这个作者说的东西有道理。但是真的要how to fix it,各位如何看?
Julie Ng, originally from Boston, now living in Munich as a designer and
entrepreneur.
The internet startup model is broken and how to fix it
The market for internet companies is broken. We cannot continue starting
companies with millions in venture capital and no business model from day
one that generates revenue, and more importantly profit.
Don't rejoice at Facebook's plummeting stock. It’s an ominous sign for us
all. Companies are willing to pay boatl... 阅读全帖
亚麻kindle fire目前的硬伤是 US residents/customers travel out of USA
See what I got from amazon website:
Well, i call Amazon support and this is it : kindle reader app will work to
buy and read books and magazines. Also, with a wifi network, its posible to
use the internet (with or without their nav) todo surf. So things like check
your email, facebook, read the news, etc.. wont be a problem. Its not going
to work for music, video, movies or apps from Amazon appstore or prime
dowloading. Plus, Amazon in... 阅读全帖