注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号 
x
Longest Common Prefix + 2
word ladder II + 1
Add Two Numbers + Add Binary +1
1. Write a function to add the two binary number strings.
add('100', '10') -> '110'
2. Follow up, add two number strings with specific base
add('100', '10', 2) -> '110'
add('100', '9', 10) -> '109'. From 1point 3acres bbs
3. Follow up, sum list number strings with specific base
add_strs(['9', '3', '2'], 10) -> ’14'
merge interval
Top 10 query keyword
假设你拿到Yelp昨天的log, 里边每一行都保存的是用户的搜索记录, 找出Top 10 query keyword.
我写了两个方法:
1. 直接用Unix command(他说有bonus): cat -> xargs -> grep -> sort -> uniq -> sort -> head
2. 写了Java code. 扫描每一行, 放进HashMap<String, Integer>. 然后扔进Heap排序, 之后pop出Top 10.
一个是判断是否是palindrome
Anagrams + 3
刚开始是用排序,hashmap<string, arraylist>写,后来改成了数组计数,又经提示,用了hashmap<hashmap<character, integer>, arraylist>这种写法。
Follow up: 怎么用map reduce做?
常规做法不是用一个HashMap<String, List<String>>去存储anagrams, 这个HashMap里的key是输入word按照字符排序得来的。
所以在mapper 里面,yield(key, word), 就这么简单。
input:
man car kile arc none like
output:
man
car arc
kile like
none.
我是用 HashTable 做的,先 sort,key 為 sort 好的,value 是一個 ArrayList<String>
如果key和value都要求有序
只排序一次,compatator中如果两个词的变位词不同,则按变位词排序,如果相同,按原词排序。
再打印的时候判断当前单词和前一个单词的变位词是否相同,如果不同则换行
如果key要求有序输出
hashmap,然后对key进行排序。
random hash map
Implement一个data structure,insert/delete/return a random element的time complexity都是O(1)
Return k most frequent words given a search history,答scan之后建hash map,然后丢进heap裡面一个一个pop。接着要我分析time/space complexity,每一步都分析了,最后一步建heap是n,然后pop_heap答是klogn,他说very good.
设计一个数据结构,要求支持插入,删除和random返回一个元素这三种操作,每种操作的复杂度都要是O(1).
删除元素后,要使用数组最后一元素交换到被删除的当前位置。并更新hashmap中的最后一元素的位置信息
followup是如果要支持duplicate数据怎么办(这个想复杂了没写完),求bless
metrics
如果给一个hash map (or any other data structure),裡面存的是工人名字,和他们做的工作list, i.e., key是每一个worker的名字,values是他们take的project名字 (P1, P3, P5 etc) as follows:
DICT[WORKER_1] = ["P1", "P3", "P10"]-google 1point3acres
DICT[WORKER_2] = ["P2", "P4", "P5"]
每次worker take project之后的时间,也会被记录下来
请想出一个metrics来evaluate which worker is more efficient in finishing projects
这题目一开始面试官说的相当ambiguous,但应该是考察面试者会不会跟面试官沟通交流
这题我光问清楚题意和assumption就花了十几分钟,后面implement了两个metrics (不过忘记了)
pascal triangle + 1
简简单单一个pascal triangle的implement,之后followup了一下fotSpot compiler in conjunction with Just In Time compilation may do so if needed. The running code is constantly being profiled by the JVM and recompiled to native code if certain rules are met. Most commonly the hot code is the first to compile natively.
How to print "Hello World" in Java, 就大概问下Java基本操作吧。
Java: pass by reference or pass by value? what does pass by value mean?
像C++ vector list等等数据结构查找删除 size()的时间复杂度.
比如interface vs abstract class. 为什么用interface. 为什么用abstract class.
Data structure
hashtable的原理
HashMap的操作 复杂度
Android
比如MVC是什么,大概说说MVC三个东西都是干什么的
The MVC pattern is essentially this:
Model: What to display
View: How it’s displayed
Controller: Formatting the model for display and handling events like user input,such as activity
测试
unit test和integrity test的区别
单元测试(unit testing),是指对软件中的最小可测试单元进行检查和验证。对于单元测试中单元的含义,一般来说,要根据实际情况去判定其具体含义,如C语言中单元指一个函数,Java里单元指一个类,图形化的软件中可以指一个窗口或一个菜单等。总的来说,单元就是人为规定的最小的被测功能模块
整合测试又称组装测试,即对程序模块采用一次性或增殖方式组装起来,对系统的接口进行正确性检验的测试工作。整合测试一般在单元测试之后、系统测试之前进行。实践表明,有时模块虽然可以单独工作,但是并不能保证组装起来也可以同时工作。
individual software modules are combined and tested as a group。It occurs after unit testing and before validation testing. Integration testing takes as its input modules that have been unit tested, groups them in larger aggregates, applies tests defined in an integration test plan to those aggregates, and delivers as its output the integrated system ready for system testing.[1]
Behaviroal questions
1. 介绍你自己.
2. 为什么选我们公司?
3. 公司网站需要什么改进的?
|