Adap.tv Interview Question for Software Engineer / Developers


Country: India
Interview Type: Phone Interview




Comment hidden because of low score. Click to expand.
0
of 0 vote

void getAllValidWords(String number, vector<string>& matchedWords)
{

   fstream file = open("WordFile", fstream::in);
   string str;
   
   while(file.getline(str) != eof) {
      if ( str.length() != number.length()) {
         continue;
      }
      if ( number == ConvertToNumber(str)) {
         matchedWords.push_back(str);
      }
   }
}

string ConvertToNumber(string str)
{
   for ( i = 0; i < str.length(); i++) {
      char c = str.at(i);
      c = tolower(c);
      c =  numberMap[c];
      str.replace(i,1,c);
   }
   return str;
}

- Anonymous January 22, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

complexity of this code would be very high !
you are end up with traversing each and every word in the file which may not needed if you could do some pre-processing on the given word file.

- pandu.vdp January 22, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

store all words in hashmap with keys as their convertonumber values and multiple values for each key.
use ur number to index the values

- bbarodia January 22, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

suggestion:
1. build a tries on the dictionary
2. create a small map . Key: int, values char[] eg: (2,new char[]{'a','b','c'})
3. do a search on tries based on the input number

- Vincent January 22, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Thanks..I also suggested same..but is this best way to do this.. what could be the running time and space complexity.

- pandu.vdp January 23, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

I do like this: making a map array, which record all the alphas and digits relations. Then open file, and process every word with length of the length of given number, ignore others which can save a lot of time. below is my codes, time complexity is O(N), if the length of word can be taken as O(1), space complexity is O(1).
#include<iostream>
#include<string>
using namespace std;

int map[26];

void init_map() {
int i;
int value = 2;
for(i = 0; i < 15; i += 3) {
map[i] = map[i + 1] = map[i + 2] = value;
value++;
}
map[15] = map[16] = map[17] = map[18] = value++;
map[19] = map[20] = map[21] = value++;
map[22] = map[23] = map[24] = map[25] = value;
}

bool process_word(char *word, char *number) {
while(*word) {
if(map[*word - 'a'] != (*number - '0')) {
return false;
}
word++;
number++;
}
return true;
}

void find_all_valid_words(char *file_path, char *number) {
char buffer[20];
int len_num = strlen(number);
FILE *input = fopen(file_path, "r");
init_map();
while(fscanf(input, "%s", buffer) != EOF) {
if(strlen(buffer) == len_num) {
if(process_word(buffer, number)) {
cout << buffer << endl;
}
}
}
}

void main() {
char number[] = "228";
char file_path[] = "words.txt";
find_all_valid_words(file_path, number);
getchar();
}

and here the test case:
bat cat act bus cut just take make bad pass typical

- yingsun1228 January 23, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

HI,

I am apperaing for adaptv. Could you please provide some questions that were asked in the interviews?

Regards

- abhaskar March 07, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

did you attend adap.tv recently? What is the mode of questions being asked? what can I expect? I am attending it next week...

- ramkumar March 25, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Simple permutation generation question with exponential complexity (size of the solution space). In this case it is of the order of 3 power n where n is the number of digits given as input..

- nishsharma April 14, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

hi pandu,

am to appearing for adap.tv can you please give me little context on what type of questions they are asking( it is even grateful if you list out other questions asked thanks)

- Ramesh January 22, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

It was my 1st telephonic and it lasted about 1 hr of which we discussed about their company and my projects and this was the only questions asked in that interview.

- pandu.vdp January 22, 2013 | Flag


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More