h*d
2 楼
没有人知道吗?
j*t
3 楼
这是trie吗? 应该是一个recursive search吧.
s*y
4 楼
static final int phoneLength=7;
char [][] keypad={{'0'},{'1'},{'a','b','c'},{'d','e','f'},
{'g','h','i'},{'j','k','l'},{'m','n','o'},
{'p','q','r','s'},{'t','u','v'},{'w','x','y','z'}};
void printWords(int [] phoneNumber){
char result []= new char [phoneLength];
doPrintWords(phoneNumber,result,0);
}
void doPrintWords(int []phoneNumber, char []result, int curIndex){
if(curIndex==phoneLength){
System.out.println(result);
return;
}
if(phoneNumber[curIndex]==0){
result[curIndex]='0';
doPrintWords(phoneNumber,result, curIndex+1);
}
else if(phoneNumber[curIndex]==1){
result[curIndex]='1';
doPrintWords(phoneNumber,result, curIndex+1);
}
else{
int numOfchar=keypad[phoneNumber[curIndex]].length;
for(int i=0;i result[curIndex]=keypad[phoneNumber[curIndex]][i];
doPrintWords(phoneNumber,result, curIndex+1);
}
}
char [][] keypad={{'0'},{'1'},{'a','b','c'},{'d','e','f'},
{'g','h','i'},{'j','k','l'},{'m','n','o'},
{'p','q','r','s'},{'t','u','v'},{'w','x','y','z'}};
void printWords(int [] phoneNumber){
char result []= new char [phoneLength];
doPrintWords(phoneNumber,result,0);
}
void doPrintWords(int []phoneNumber, char []result, int curIndex){
if(curIndex==phoneLength){
System.out.println(result);
return;
}
if(phoneNumber[curIndex]==0){
result[curIndex]='0';
doPrintWords(phoneNumber,result, curIndex+1);
}
else if(phoneNumber[curIndex]==1){
result[curIndex]='1';
doPrintWords(phoneNumber,result, curIndex+1);
}
else{
int numOfchar=keypad[phoneNumber[curIndex]].length;
for(int i=0;i
doPrintWords(phoneNumber,result, curIndex+1);
}
}
h*d
5 楼
这个是print电话对应的字母吧?
【在 s********y 的大作中提到】
: static final int phoneLength=7;
: char [][] keypad={{'0'},{'1'},{'a','b','c'},{'d','e','f'},
: {'g','h','i'},{'j','k','l'},{'m','n','o'},
: {'p','q','r','s'},{'t','u','v'},{'w','x','y','z'}};
: void printWords(int [] phoneNumber){
: char result []= new char [phoneLength];
: doPrintWords(phoneNumber,result,0);
: }
: void doPrintWords(int []phoneNumber, char []result, int curIndex){
: if(curIndex==phoneLength){
【在 s********y 的大作中提到】
: static final int phoneLength=7;
: char [][] keypad={{'0'},{'1'},{'a','b','c'},{'d','e','f'},
: {'g','h','i'},{'j','k','l'},{'m','n','o'},
: {'p','q','r','s'},{'t','u','v'},{'w','x','y','z'}};
: void printWords(int [] phoneNumber){
: char result []= new char [phoneLength];
: doPrintWords(phoneNumber,result,0);
: }
: void doPrintWords(int []phoneNumber, char []result, int curIndex){
: if(curIndex==phoneLength){
c*2
8 楼
This is a lookup problem.
To use prefix tree for this: build the tree with 0-9, at the end node, store
person's name.
(This is similar to routing table lookup.)
Can also be done with hash mapping.
To use prefix tree for this: build the tree with 0-9, at the end node, store
person's name.
(This is similar to routing table lookup.)
Can also be done with hash mapping.
相关阅读
曾经工作过的公司还可以再申请吗?招C++ contractor明天dream 公司job fair机械工程本科毕业找与专业相关的工作hackercup这次的题太难了问个H1b Transfer问题关于publication一问interviewstreet的string reduction是不是只能brute forceTMD,这种HM太恶心了.征web软件工程师 mid level请问google phone interview的feedback 要多久才能收到?on site面试能要误工费吗?有什么比较好的学习sql的书或视频吗?有经验的支支招,怎么和猎头谈工资请问如何速成java,应付面试。请教Amazon电面的形式,现在电面就需要在线coding吗?3年博后,Delaware的化工公司年薪多少合适啊?征CM软件工程师问道 L家 的题为什么这么多CS,IT的工作机会,没有化工类的?