j**7 发帖数: 143 | 1 一共面了四个人,都是SDET
1.面试官:印度人lead SDET
Given a random matrix of characters, find all the locations of the following
list of words:cat,dog,ate. We have to look in 8 directions.
e g o d
a c a t
e a t e
k t q z
2. 面试官:姓陈,Lead SDET,美籍华裔?
第二轮是lunch interview.简单做自我介绍。介绍SDET这个position.然后吃完饭回到
办公室继续面试。
given a function,explain what it does.
int my_fun(int x ,int y)
{
return x + (int)((y-x)*rand());//rand() returns a real number between 0
and 1, inclusively.
}
我当时回答my_fun应该return x和y之间的一个integer.
然后要test function.
Follow up: 怎么用程序来证明my_fun一定return random integer?
Follow up2: How to detect a pattern in the distribution of the random
integers? Ex. 1,2,3,1,2,3,1,2,3
3.面试官:白人SDET,没问是不是lead
Given an equation (Ex."2*5+1+3*6" or "3/6-1*4+1") as a string,calculate the
equation. So "2*5+1" becomes 10+1=11.我用了divide and conquer.
把“2*5+1”变成 "2*5" 和 “1”。分别计算两个sub-problem.。
4.面试官:白人 lead SDET
reverse a linked list.我用了recursion.面试官不太满意。 | j**7 发帖数: 143 | 2 一共面了四个人,都是SDET
1.面试官:印度人lead SDET
Given a random matrix of characters, find all the locations of the following
list of words:cat,dog,ate. We have to look in 8 directions.
e g o d
a c a t
e a t e
k t q z
2. 面试官:姓陈,Lead SDET,美籍华裔?
第二轮是lunch interview.简单做自我介绍。介绍SDET这个position.然后吃完饭回到
办公室继续面试。
given a function,explain what it does.
int my_fun(int x ,int y)
{
return x + (int)((y-x)*rand());//rand() returns a real number between 0
and 1, inclusively.
}
我当时回答my_fun应该return x和y之间的一个integer.
然后要test function.
Follow up: 怎么用程序来证明my_fun一定return random integer?
Follow up2: How to detect a pattern in the distribution of the random
integers? Ex. 1,2,3,1,2,3,1,2,3
3.面试官:白人SDET,没问是不是lead
Given an equation (Ex."2*5+1+3*6" or "3/6-1*4+1") as a string,calculate the
equation. So "2*5+1" becomes 10+1=11.我用了divide and conquer.
把“2*5+1”变成 "2*5" 和 “1”。分别计算两个sub-problem.。
4.面试官:白人 lead SDET
reverse a linked list.我用了recursion.面试官不太满意。 | h********g 发帖数: 496 | 3 Follow up: 怎么用程序来证明my_fun一定return random integer?
Follow up2: How to detect a pattern in the distribution of the random
integers? Ex. 1,2,3,1,2,3,1,2,3
followup 2怎么做?
following
【在 j**7 的大作中提到】 : 一共面了四个人,都是SDET : 1.面试官:印度人lead SDET : Given a random matrix of characters, find all the locations of the following : list of words:cat,dog,ate. We have to look in 8 directions. : e g o d : a c a t : e a t e : k t q z : 2. 面试官:姓陈,Lead SDET,美籍华裔? : 第二轮是lunch interview.简单做自我介绍。介绍SDET这个position.然后吃完饭回到
| r**h 发帖数: 1288 | 4 反转链表的题,见到有人用循环,面试官不满意说要递归
这里lz用了递归,面试官又不满意
这该如何是好
following
【在 j**7 的大作中提到】 : 一共面了四个人,都是SDET : 1.面试官:印度人lead SDET : Given a random matrix of characters, find all the locations of the following : list of words:cat,dog,ate. We have to look in 8 directions. : e g o d : a c a t : e a t e : k t q z : 2. 面试官:姓陈,Lead SDET,美籍华裔? : 第二轮是lunch interview.简单做自我介绍。介绍SDET这个position.然后吃完饭回到
| h********g 发帖数: 496 | 5 两个都写给他,呵呵
【在 r**h 的大作中提到】 : 反转链表的题,见到有人用循环,面试官不满意说要递归 : 这里lz用了递归,面试官又不满意 : 这该如何是好 : : following
| b******7 发帖数: 92 | 6 3表达式求值用divide and conquer很奇怪也没有必要。还是双栈解法标准
4肯定写迭代啊,这种尾递归换成迭代连个stack都省了。我觉得同一个算法用递归写和
迭代写,明显后者更能显示你的能力 | n*******w 发帖数: 687 | 7 re
曾经面G,有个题第一步是遍历树都要用跌代写。那题还不是考树的遍历。
【在 b******7 的大作中提到】 : 3表达式求值用divide and conquer很奇怪也没有必要。还是双栈解法标准 : 4肯定写迭代啊,这种尾递归换成迭代连个stack都省了。我觉得同一个算法用递归写和 : 迭代写,明显后者更能显示你的能力
| r********9 发帖数: 1116 | 8 什么叫双栈解法
【在 b******7 的大作中提到】 : 3表达式求值用divide and conquer很奇怪也没有必要。还是双栈解法标准 : 4肯定写迭代啊,这种尾递归换成迭代连个stack都省了。我觉得同一个算法用递归写和 : 迭代写,明显后者更能显示你的能力
| e***s 发帖数: 799 | 9 请问问题2,被问到怎么test function 的时候是不是提供test case?
follow up 1 和 2 怎么回答啊? | j**7 发帖数: 143 | 10 第三题应该用stack把infix expression转换成一个postfix expression,然后用stack
计算postfix expression.
【在 r********9 的大作中提到】 : 什么叫双栈解法
| | | j**7 发帖数: 143 | 11 第三题的答案:
public class InfixToPostfix {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
String infix="4*((5+6)*7";
infix="3+(1*2)";
String postfix=toPostfix(infix);
System.out.println(postfix);
System.out.println(evaluate(postfix));
}
//evaluate a postfix equation
static int evaluate(String postfix)
{
Stack st=new Stack();
for(int i=0;i
{
char c=postfix.charAt(i);
if(isOperator(c)==true)
{
int x=st.pop();
int y=st.pop();
if(c=='+')
{
st.push(x+y);
}
else if(c=='-')
{
st.push(y-x);
}
else if(c=='*')
{
st.push(x*y);
}
else
{
st.push(y/x);
}
}
else
{
st.push(c -'0');
}
}
return st.pop();
}
//convert infix to postfix
static String toPostfix(String infix) {
StringBuilder postfix = new StringBuilder();
Stack st = new Stack();
for (int i = 0; i < infix.length(); i++) {
char c = infix.charAt(i);
if (isOperator(c) == true) {
while (st.isEmpty()==false) {
char temp = st.peek();
if (temp!='(' && order(temp) > order(c)) {
st.pop();
postfix.append(temp);
}
else
{
break;
}
}
st.push(c);
}
else if(c=='(')
{
st.add(c);
}
else if(c==')')
{
while (st.isEmpty()==false) {
char temp=st.pop();
if(temp=='(')
{
break;
}
else
{
postfix.append(temp);
}
}
}
else {
postfix.append(c);
}
}
while (st.isEmpty() == false) {
char c = st.pop();
postfix.append(c);
}
return postfix.toString();
}
static int order(char c) {
if (c == '+' || c == '-') {
return 0;
} else {
return 1;
}
}
static boolean isOperator(char c) {
if (c == '+' || c == '-' || c == '*' || c == '/') {
return true;
} else {
return false;
}
}
} | w********p 发帖数: 948 | 12 有人用stack, 面试管非得要divide and conquer
【在 b******7 的大作中提到】 : 3表达式求值用divide and conquer很奇怪也没有必要。还是双栈解法标准 : 4肯定写迭代啊,这种尾递归换成迭代连个stack都省了。我觉得同一个算法用递归写和 : 迭代写,明显后者更能显示你的能力
| j**7 发帖数: 143 | 13 是要求写test case.
Follow up 1: 计算每个integer出现的次数(count).如果distribution是random的,
出现的次数应该是一样的。
Follow up 2: Ex. 1,2,3,1,2,3,1,2,3 规律是1,2,3.这个pattern不断地重复。
在第一个1和第二个1之间的subarray是(2,3). 如果在第二个1和第三个1之间的
subarray同样也是(2,3),那么(1,2,3)肯定是个pattern.
【在 e***s 的大作中提到】 : 请问问题2,被问到怎么test function 的时候是不是提供test case? : follow up 1 和 2 怎么回答啊?
| e***s 发帖数: 799 | 14 非常感谢!!
【在 j**7 的大作中提到】 : 是要求写test case. : Follow up 1: 计算每个integer出现的次数(count).如果distribution是random的, : 出现的次数应该是一样的。 : Follow up 2: Ex. 1,2,3,1,2,3,1,2,3 规律是1,2,3.这个pattern不断地重复。 : 在第一个1和第二个1之间的subarray是(2,3). 如果在第二个1和第三个1之间的 : subarray同样也是(2,3),那么(1,2,3)肯定是个pattern.
| e***s 发帖数: 799 | 15 第三题楼主是相当于把原式写成逆波兰,然后再计算吧? | f******n 发帖数: 198 | 16 其实没有什么面试官满意不满意的,微软entry-level面试主要看四项: Intellectual
Horsepower, Problem-solving Skill, Dealing with Conflicts, and Communication
. 要是哪个面试官分到注重Dealing with Conflicts,那就只好做恶人,你用循环他就
要递归,你用递归他就要循环。 | w********p 发帖数: 948 | 17 如果是再扩展下,detect 任何一种pattern, 就很头痛。
【在 j**7 的大作中提到】 : 是要求写test case. : Follow up 1: 计算每个integer出现的次数(count).如果distribution是random的, : 出现的次数应该是一样的。 : Follow up 2: Ex. 1,2,3,1,2,3,1,2,3 规律是1,2,3.这个pattern不断地重复。 : 在第一个1和第二个1之间的subarray是(2,3). 如果在第二个1和第三个1之间的 : subarray同样也是(2,3),那么(1,2,3)肯定是个pattern.
| j**7 发帖数: 143 | 18 Yes.
【在 e***s 的大作中提到】 : 第三题楼主是相当于把原式写成逆波兰,然后再计算吧?
| s*********s 发帖数: 318 | | j**7 发帖数: 143 | 20
挂了
【在 s*********s 的大作中提到】 : >面了四个人 : 是不是算挂了?不懂的说?
|
|