由买买提看人间百态

topics

全部话题 - 话题: helpers
首页 上页 1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)
m*****n
发帖数: 204
1
来自主题: JobHunting版 - Java编程讨论:LinkedIn的H2O
原题见http://www.mitbbs.com/article_t/JobHunting/32331973.html
这道题不是单纯作对就好的。那里贴出的解法有些值得商榷的地方。我这里谈谈个人见
解供大家参考。
从Java的角度看这道题可以有三个考点:
对Java Synchronization and Concurrency的掌握
基本的Coding Style,要能扩展,不能写spaghetti code
有把握的话可以讨论一下Lock Free Synchronization. 这题理论上只用AtomicInteger
也行。
看到这道题之后首先应该和面试者交流一下,看是否一定要用synchronized-wait-
notify. 如果不要求就不要用了,用这个既花时间又容易出错,还显得不够up to date
。当然有人可能觉得这个考基本功非要你用那也没办法。
我的基本思路是:
- 用synchronousQueue去Block and release caller threads
- 用AtomicInterger计数
- Thread Synchronization下面再... 阅读全帖
m*****n
发帖数: 204
2
来自主题: JobHunting版 - Java编程讨论:LinkedIn的H2O
原题见http://www.mitbbs.com/article_t/JobHunting/32331973.html
这道题不是单纯作对就好的。那里贴出的解法有些值得商榷的地方。我这里谈谈个人见
解供大家参考。
从Java的角度看这道题可以有三个考点:
对Java Synchronization and Concurrency的掌握
基本的Coding Style,要能扩展,不能写spaghetti code
有把握的话可以讨论一下Lock Free Synchronization. 这题理论上只用AtomicInteger
也行。
看到这道题之后首先应该和面试者交流一下,看是否一定要用synchronized-wait-
notify. 如果不要求就不要用了,用这个既花时间又容易出错,还显得不够up to date
。当然有人可能觉得这个考基本功非要你用那也没办法。
我的基本思路是:
- 用synchronousQueue去Block and release caller threads
- 用AtomicInterger计数
- Thread Synchronization下面再... 阅读全帖
i**********e
发帖数: 1145
3
adapter 工作中挺常见的,一直看到过,但没留意这也是 GOF 里的其中一个 DP 。
之前就一直认为像个 helper function 把一个data massage 到另一种data格式。
J*******A
发帖数: 8401
4
打杂
helper

那周边专业在石油公司的叫啥?
s******n
发帖数: 226
5
来自主题: JobHunting版 - 一道rf的面试题
Complete code:
import java.util.*;
import java.lang.Math.*;
// Customized Tree for sorting ending times and count how many ending times
are earlier than inserted one to compute the racer's score.
// Insertion is O(nlgn)
class node{
int val;
int below;
node left;
node right;
node(int val){this.val = val; left = right = null; below = 0;}
}
class Tree{
node root;
Tree(){root = null;}
int insert(int val){
node N = root;
if(N == null){
root ... 阅读全帖
y***5
发帖数: 21
6
结果:面试7家,5 onsite,3 offer。
面经:
Amazon:2轮电面,5轮onsite。2天后offer,最后decline,非常nice的manager(拿到
A offer时还在面其它公司,比较大度地祝我good luck),拒绝的时候感情上比较难受。
电面1,设计parking lot
2, intersection of sorted int array; design data structure for a phone
contact book
onsite 1: find biggest int in array,
find K biggest int in array(tradeoff between many methods),
implement using heap
2: print modification path from "head" to "tail", given isWord()
api and every time can modify 1 word in the strin... 阅读全帖
r*****e
发帖数: 792
7
来自主题: JobHunting版 - G的offer只有5天考虑时间吗?
接着来F的:
第二个:system design,老印,让设计messaging system,但是一上来就让
设计怎么存放聊天记录,放哪,怎么快速access记录。我说不先来个overall的
system picture吗,他说不用,非要不停地讨论细节。这玩意我从来没干过,
纠结于细节就是想搞死我啊。好歹大面上说完,再讨论细节也好啊。我完事后
和我F的朋友在lobby聊天,说要是完就完在这老印手上。结果的确如此,这次是
recuirter和我讲的。我向recruiter表示感谢后,complain了一下那个老印,
就算屁用没有,也得complain,反正以后也不打算去F了。
第三个:找和远点距离最近的k个点,已经有人贴过这道题了。要注意的是计算
距离时要更有效,我当时想都没想就写了个最正确的helper function,但是
做了无用功,后来经提示改了。然后是找LCA,我先问有没有parent ptr的,回答
假设可以有。中间有个误会,我跟他说就等于两个链表找第一个重复的node,被告知不
能用额外的memory,我心想不用啊,于是有些糊涂了,想他肯定是想要leetcode上那个... 阅读全帖
g********E
发帖数: 178
8
来自主题: JobHunting版 - 吐槽下今天的面试
你这个我一开始就提了,需要一个helper function,不然很难避免重复打印,但是美眉
坚持表示只需要在一个function里面完成,也就是她说的那种
z***y
发帖数: 50
9
来自主题: JobHunting版 - 问一道题(2)
比如要处理下面的数列:
-3 -2 -4 1 4 -5 -2 -1 2 4
↑ ↑ ↑
i mid j
翻转(i,j)部分后变成
-3 -2 -4 -1 -2 -5 4 1 2 4;
↑ ↑
i j
再翻转两段
-3 -2 -4 -5 -2 -1 1 4 2 4.
Helper函数先循环调用两次, 把前半段和后半段都处理好.
然后只需把前半段的非负数和后半段的非正数处理好就行了.
三次翻转就可以了, 方法类似于把一篇文章以单词为单位头尾调换.
D******y
发帖数: 316
10
我大概两周前做的test,昨天被据的,题目基本上就是网上能搜到的几道题.除了两分钟
的题没做完,编程部分有一道题不想耗时间了(其实好像没有时间限制),有两个helper没
写. 我觉得编程题目对我来说有点难度,我提前还算准备了,看看拿到onsite人是做到什
么程度吧.
a******e
发帖数: 710
11
来自主题: JobHunting版 - T家电面面经并且不解为何被秒拒
lz第一道题的解法有个问题就是helper里面的str数组没有初始化过,也就是没有预先
分配空间。运行的时候会出现访问数组越界的错误。
第二道题, n_permutation/=m的时候,m可能等于零。这个情况要单独处理。

45
complain
l*n
发帖数: 529
12
来自主题: JobHunting版 - DP 的 memorized 放在哪里?
// wrapper
public boolean doable(String s) {
int[] memo=new int[s.length()+1];
Arrays.fill(memo, -1);
return doable(s, 0, memo)==1;
}
// helper
int doable(String s, int i, int[] memo) {
......
if (memo[i+1]==-1) memo[i+1] = doable(s, i+1, memo);
......
}
A**d
发帖数: 13310
13
来自主题: JobHunting版 - leetcode的OJ也会有错吗??
a minor detail: why do you make your helper function public?
m*****n
发帖数: 204
14
来自主题: JobHunting版 - 小弟求问LinkedIn那道Deep Iterator的题
攒了个段子请大牛点评一下:
// Not thread-safe
// Talk about validation requirement: none vs in next() vs in constructor
private static class DeepIterator implements Iterator {
private final Iterator myIterator;

private final Class eleType;

private final Iterator empty = new ArrayList().iterator();

private Iterator head = empty;

DeepIterator(List list, Class eleType) {
this.myIterator = list.iterator();
this.eleType = e... 阅读全帖
m*****n
发帖数: 204
15
来自主题: JobHunting版 - 小弟求问LinkedIn那道Deep Iterator的题
攒了个段子请大牛点评一下:
// Not thread-safe
// Talk about validation requirement: none vs in next() vs in constructor
private static class DeepIterator implements Iterator {
private final Iterator myIterator;

private final Class eleType;

private final Iterator empty = new ArrayList().iterator();

private Iterator head = empty;

DeepIterator(List list, Class eleType) {
this.myIterator = list.iterator();
this.eleType = e... 阅读全帖
A**d
发帖数: 13310
16
来自主题: JobHunting版 - 大家刷leetcode的速度有多块?
Then I recommend you to start with TopCoder. Don't
need to try Division 2 level 3. By the time you can
fluently deal with muti-level loops, complex boolean
statements, helper functions, and common data structures,
you can start with Leetcode. Make sure you can code
simple algorithms fluently. There are quite some real
interview questions that don't require complex algorithms
but purposely make it hard to handle parameters, loops,
and recursions,etc. You may notice TopCoder uses int array
a lot, ... 阅读全帖
s**x
发帖数: 7506
17
来自主题: JobHunting版 - Leetcode Valid Number
我的想法, 极其简单, I could not find anything wrong, I found most of the
solutions are difficult to write and easy to make mistakes.
you can finish the following in less than 5 minutes and most importantly
hard to make mistakes.
bool isValide(char *string)
{
char *p = string;
if (p == NULL) return false;
p += skipWhiteSpaces(p);
p += skipSigns(p);
int n1 = skipDigits(p);
p+= n1;
if (*p == '.') p++;

int n2 = skipDigits(p);
if (n1 == 0 && n2 == 0) return false;

if (*p == ... 阅读全帖
m*****n
发帖数: 204
18
Start with pseudo code for helper methods and classes.
Fill in details if you have time.
r*******e
发帖数: 971
19
来自主题: JobHunting版 - reverse words in a string
isspace 这是啥么?有必要新造一个helper么?
y*****i
发帖数: 141
20
来自主题: JobHunting版 - 一道G家onsite题
睡前XJB写两句。。
你需要这么几个helper function:
void PushToCornor(Block) //把一个俄罗斯方块推向一个NXN grid的某个角落
void Rotate(Block, direction) //向direction rotate你的方块
attach_another_square_to_this_square() //这个没想清楚signature,意思就是拿到
一个square,给他attach一个legitimate neighboring square
然后递归解:
//以下都是秀逗扣的:
vector generateBlocks(target, current, vector & current_blocks
) {
if (current == target) {
return current_blocks;
}

for(auto block: blocks) {
for(auto square: block) {
... 阅读全帖
h***k
发帖数: 161
21
来自主题: JobHunting版 - G 店面
G onsite碰到这道题。思路是首先满足第二个条件,就是先random一个valid move,然
后开始一边fill board一边查相邻是否valid,是用sudoku那题的backtracking。表示
完整写完code时间不够,只写了个主要的结构,查valid的helper method跟面试官讨论
了下如何实现就没有写出来。
n******n
发帖数: 12088
22
来自主题: JobHunting版 - 再来bitch一下
helper在哪里?
b******n
发帖数: 851
23
来自主题: JobHunting版 - 再来bitch一下
u mean where's helper function called?
int findKthLargestElement(TreeNode root, int k) {
...
}
我的code和我贴的link里, 没什么区别。 我link里的code, 多个static counter
a***e
发帖数: 413
24
http://articles.leetcode.com/2011/09/regular-expression-matchin
在什么输入下时间复杂度是O(2^n)? 怎么老觉得是O(N^2)呢?
class Solution {
public:
bool helper(const char *s, const char *p)
{
return ((*s==*p)||(*p=='.'&&*s!='
s**x
发帖数: 7506
25
来自主题: JobHunting版 - 都来说说leetcode上无聊恶心的题吧

抓关键, 抓本质, 大多数的interview 题目10 行左右就能解决。 超过 20 行的很可
能就是算法问题或代码不够简洁了。
代码实在多, 就多假定可以利用的 helper functions, implement or explain
later if you have time.
k****r
发帖数: 807
26
来自主题: JobHunting版 - 求问一个dp题的runtime
Since never know which value will help to get the maxValue for each helper's
return, a value list should be saved.
Then, one loop to check each operator. Two loops to check every possible
pair of sub-parts?
k******4
发帖数: 7
27
为了防止违反NDA,就不列出公司名了,就是一些常见公司。
1. Write a iterator to iterate a nested array.
For example, for given array: [1, 2, [3, [4, 5], [6, 7], 8], 9, 10]
call iterator.next() 10 times should return 1,2,3,4,5,6,7,8,9,10.
用了stack存(array, index)的tuple。
2. LeetCode 原题,120 - Triange。有一点变种,给的是一维数组。
3. Implement HashTable 主要看dynamic expanding
4. Implement MaxHeap.
5. Topology sort,就是版上常见的给一些排过序的未知语言的词,求该语言的字母序
。要求实现核心算法。可以给出一些helper function定义不需实现。
6. LeetCode 付费题 157 & 158 - Read N Characters Given Rea... 阅读全帖
c******a
发帖数: 198
28
来自主题: JobHunting版 - Two CS interview questions
1. Given a method (public int Rand()) that returns any random integer in the
int range, write a wrapper method that returns a random number within a
specific range [min, max], assuming int.MinValue <= min <= max <= int.
MaxValue.
my solution was: min + (Rand() - int.MinValue) * (max - min + 1) / (int.
MaxValue - int.MinValue + 1), and use long type to account for overflow
issue. is this solution correct?
2. Given a M*N matrix where some cells are blocked and there may or may not
be a cell which ... 阅读全帖
j********r
发帖数: 127
29
来自主题: JobHunting版 - Two CS interview questions
1. return min + (rand() - min) % (max - min + 1);
2. DFS (depth first search) or BFS (breadth first search)

the
not
cell
helper
l*3
发帖数: 2279
30
来自主题: JobHunting版 - 问道G的onsite题
就用recursion, 把是否该删除本节点的信息用函数递归带回来就行了,也不需要
hashmap, 不知道楼上们
为啥有些说的那么复杂。c++程序如下:
// helper function. 其中 parentIndices 是原来记录parent的数组,visited是记录
访问信息,toDelete是记录是否需要删除的信息,target是题目中给的目标节点。
void deleteHelper(vector& visited, vector& toDelete, vector
& parentIndices, int curIndex, int target) {
if (!visited[curIndex]) {
visited[curIndex] = true;
if (curIndex == target) {
toDelete[curIndex] = true;
} else {
deleteHelper(visited, toDelete, parentIndices, parentIndices[curIndex],
target)... 阅读全帖
t*****d
发帖数: 525
31
来自主题: JobHunting版 - 老码农骂小码农的强文。 (转载)
【 以下文字转载自 PDA 讨论区 】
发信人: weidong (伊拉克学习小组副组长), 信区: PDA
标 题: 老码农骂小码农的强文。
发信站: BBS 未名空间站 (Mon Nov 2 19:52:49 2015, 美东)
Linus Tovalds骂瞎写代码的小码农,荡气回肠,应该下发所有码农学习。
Christ people. This is just sh*t
.The conflict I get is due to stupid new gcc header file crap. But what
makes me upset is that the crap is for completely bogus reasons.
This is the old code in net/ipv6/ip6_output.c:
mtu -= hlen + sizeof(struct frag_hdr);
and this is the new “improved” code that uses fancy stuff that wants
magical built-in... 阅读全帖
n********e
发帖数: 1630
32
【 以下文字转载自 biojailbreak 俱乐部 】
发信人: nolovefate (nolovefate), 信区: biojailbreak
标 题: 转行求分析web developer的工作
发信站: BBS 未名空间站 (Fri Nov 13 02:03:38 2015, 美东)
看了很多bootcamp,每个都方向不一样。其中一个是app academy,下面是12周的
schedule。能不能请懂行的人分析一下呢。我生物博后,不太懂这些。听说web dev前
景在计算机里面也是一般的。 不知道大家建议学吗?
另外一个我感兴趣的就是data science,需要统计,python,ML,SQL 我觉得也可以。
不知道大家有什么建议?
谢谢了
不胜感激
SCHEDULE
Week 1
Ruby + Object-Oriented Design
Basic + Intermediate Ruby
Object-Oriented Design
File I/O
Basic Algorithms + Data Structures
Code Quality
Week 2
R... 阅读全帖
d******o
发帖数: 13
33
来自主题: JobHunting版 - 求指点一道G家Iterator的题目
Stack + 递归
之前面Twitter也被问到过,但是迷迷糊糊没想清楚。。。
需要一个 helper class: Pair(NestedList list, int position) 定义当前所在的位
置.
Iterator 需要实现 hasNext() 和 next()
hasNext 检查还有没有值,检查栈顶的Pair,如果当前所指的是Node,直接输出 true
即可。如果是List,就new 一个 Pair(curList, 0), push到stack上。然后递归的
call hasNext 进行检查。如果 栈顶的position 已经超出 当前list 的范围,说明已
经遍历完当前list, pop 掉当前元素,然后对新的栈顶元素(如果有的话)的
position + 1, 之后同样 递归的 call hasNext 继续进行检查。
至于next,上面的 hasNext 保证了 如果还有值,会让栈顶的Pair指到一个Node,所以
直接输出即可,并将 position + 1.
d******o
发帖数: 13
34
来自主题: JobHunting版 - 求指点一道G家Iterator的题目
Stack + 递归
之前面Twitter也被问到过,但是迷迷糊糊没想清楚。。。
需要一个 helper class: Pair(NestedList list, int position) 定义当前所在的位
置.
Iterator 需要实现 hasNext() 和 next()
hasNext 检查还有没有值,检查栈顶的Pair,如果当前所指的是Node,直接输出 true
即可。如果是List,就new 一个 Pair(curList, 0), push到stack上。然后递归的
call hasNext 进行检查。如果 栈顶的position 已经超出 当前list 的范围,说明已
经遍历完当前list, pop 掉当前元素,然后对新的栈顶元素(如果有的话)的
position + 1, 之后同样 递归的 call hasNext 继续进行检查。
至于next,上面的 hasNext 保证了 如果还有值,会让栈顶的Pair指到一个Node,所以
直接输出即可,并将 position + 1.
j*******l
发帖数: 1066
35
来自主题: JobHunting版 - 碰到奇葩组(组员)
我对这类问题也思考过不少 来说说看法
你是新人 他比你职位高 对你说话占据制高点是可以理解的 在彼此不熟悉的情况下 旧
人要求新人按自己的想法来 是一种下意识的职业保护
我觉得做为新人 必须要表达出对旧人足够的尊重 才能成功让别人把你当做自己人 类
似于梁山入伙要交投名状
具体分析他要你改的几点
“他疯狂追求语言的细节,能用Java8的一定不能用Java7。一天到晚Lambda
Expression,搞得我的Deadline都交不了活”
“今天有几行代码,可以调用两个函数用三行完成。他要求我另外写一个Helper函数,
一行完成”
这2个都是语言实现的细节问题 无论如何写都不影响大功能 在这种情况我推荐新人“
无脑”听从“老人”或职位高的人的要求 更何况我觉得他的这2个意见确实更好
如果他的要求明显不合理 那你可以私底下以向他学习的角度进行询问 但千万别直接在
code review里直接回复你对他的意见的不认可 这种把分歧摆上台面的做法对一个没资
历的新人只有坏处
如果你对他表达了足够的尊重和谦卑 他依然对你颐指气使 没有改善的迹象 那我建议
你在彻底撕破脸皮前找他吃个饭或喝咖啡聊... 阅读全帖

发帖数: 1
36
来自主题: JobHunting版 - google 面经
怎么学的数学?
什么stack,queue,想得太复杂,只要考虑后两位就好了
100的整数倍都能被4整除,每次用helper function update一下string就好了,
比方说
“1231251241523”
看最后两位,23+1=24能被4整除,所以选择+1,除以2以后就是12
1231251241500用个list,考虑carry就可以了,算出来的number + 12就好了

发帖数: 1
37
来自主题: JobHunting版 - google 面经
怎么学的数学?
什么stack,queue,想得太复杂,只要考虑后两位就好了
100的整数倍都能被4整除,每次用helper function update一下string就好了,
比方说
“1231251241523”
看最后两位,23+1=24能被4整除,所以选择+1,除以2以后就是12
1231251241500用个list,考虑carry就可以了,算出来的number + 12就好了
r********k
发帖数: 258
38
来自主题: JobHunting版 - 老中不帮个别老中不是没有原因的
If you respond the first email politely, you might gain appreciation from
both his boss and him. For example, you tells him how to find out who
changes the file from some code management system to demonstrate your
leadership skill. Furthermore, you can even offer your help to restore the
file in the eyes of big boss. Your good deed will be recognized by the big
boss since the email is cc-ed to big boss. I would say you missed an
opportunity he gave you to move up in your career via ccing email t... 阅读全帖
g********e
发帖数: 1142
39
来自主题: JobHunting版 - 时间长不面试不适应啊
现在都流行pair programming,
以前只是白板写写,有些helper function就skip过去了。
现在也写leetcode,但有时过度依赖测试用例来检查逻辑,
反而见到新题,没有了online judge,有些不适应,虽然都写出来,
运行编译都过了,可能中间有些磕磕碰碰,给interviewer的感觉比较不好。
这是最近的两场onsite的感受,同学们要注点意,尤其是老干部们。
t****b
发帖数: 2484
40
来自主题: JobHunting版 - 脸家电话面试面筋
牛 我还想着用个flag标一下增减
这样写个helper 然后扫两遍就够了 又快又好
y******x
发帖数: 31
41
来自主题: JobHunting版 - 脸家电话面试面筋
扫一遍看最大最小值是不是在两端也行吧。


: 牛 我还想着用个flag标一下增减

: 这样写个helper 然后扫两遍就够了 又快又好

l***c
发帖数: 1634
42
来自主题: JobHunting版 - amazon的OA其中一题没过影响大吗?
做了好几个公司的oa,基本上都是要求时间的1/2 - 3/4完成
只有amazon的做足了90分钟,还是没完全搞定
第二道题里面5个helper function至少有两个是medium难度的
拜托,我是转专业的,没工作经验,还对我这么狠?
继续嘻唰唰,哼哼
e***w
发帖数: 1160
43
A store in Poughkeepsie Galleria Mall is looking for a store Cashier.
It is close to New York City.
The store sells Asian Arts Stuff.
Flexible working time.
Chinese Speaker prefered.
Female prefered
For detail, Call Mr. liu at 646-645-5558
e***w
发帖数: 1160
44
来自主题: JobMarket版 - look for a store helper/Cashier (stamford)
The store is in Stamford Town Center Connecticut.
地点: 100 Greyrock Place Stamford, CT 06901
要求:懂英文。
女性优先.
Flexible working time.
For detail, Call Mr. liu at 646-645-5558
本广告长期有效。
e***w
发帖数: 1160
45
Crystal Mall Asian Arts store looking for store helper/cashier.
Flexible hours.
要求:懂英文。
请联系:刘先生(646)-645-5558
Address
850 Hartford Turnpike
Waterford, CT 06385
j****g
发帖数: 632
46
来自主题: JobMarket版 - 寻日本餐sushi helper的工作
new york地区最好,寿司助手
j****g
发帖数: 632
47
来自主题: JobMarket版 - 寻日本餐sushi helper的工作
3479850629
f*******d
发帖数: 68
48
来自主题: JobMarket版 - Looking for a house helper....
We need someone to come to our house help cleaning and cooking in weekdays.
Good pay.
Please call: 847-800-9979.
Thank you!
v******a
发帖数: 2
49
来自主题: JobMarket版 - 聘会做饭小时工(Jersey City, NJ)
I need a helper on week days to prepare the dinner and clean the home. We
are in Jersey city, NJ. Please call 201-736-8158.
z****z
发帖数: 48
50
来自主题: JobMarket版 - NJ -FORTLEE请人周末打扫卫生
I need a helper on weekend to clean the home. We
are in forlee, NJ. please drop a email to z****[email protected]. tks.
首页 上页 1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)