Platform9
Drive was of total 5 rounds
- Task Submission
- Technical Interview 1
- Technical Interview 2
- Technical Interview 3
- Behavioural Interview
Task Given:
Problem:Implement a type ahead with a regex “*”. For e.g sample input queries could be suggest all words starting with “wa”, “st*t”, “ra*ct”.
This is an open ended question, while the obvious answer for type ahead is with trie data structure the regex makes it a bit complex. The answer should optimize on the amount of memory and the number of times the tree is traversed up and down in an effort to match the regex. Will also test design considerations about setting up an in-memory data structure and ways to traverse it.
Solution code: (language C++)
#includeusing namespace std; struct Trie{ struct Trie* child[26]; bool wordend; }; void insert(struct Trie* head,string name){ struct Trie* temp=head; for(int i=0;i child[val]){ struct Trie* temp2=new Trie; temp2->wordend=false; for(int j=0;j<26;j++)temp2->child[j]=NULL; temp->child[val]=temp2; } temp=temp->child[val]; } temp->wordend=true; } bool islast(struct Trie* head){ for(int i=0;i<26;i++){ if(head->child[i])return 0; } return 1; } void suggestion(struct Trie* head,string curr){ if(head->wordend){ cout< child[i]){ curr.push_back(97+i); suggestion(head->child[i],curr); curr.pop_back(); } } } int printsuggestion(struct Trie* head,string query){ struct Trie* temp=head; for(int i=0;i child[query[i]-'a'])return 0; temp=temp->child[query[i]-'a']; } bool isWord = (temp->wordend == true); bool isLastt = islast(temp); if (isWord && isLastt) { cout << query << endl; return -1; } if(!isLastt){ string prefix=query; suggestion(temp,prefix); return 1; } } bool isposs(struct Trie* head,string query){ struct Trie* temp=head; for(int i=0;i child[val])return 0; temp=temp->child[val]; } return 1; } void printresult(struct Trie* head,string query,int n,string curr){ if(n==query.length()){ printsuggestion(head,curr); return ; } if(query[n]=='*'){ for(int i=0;i<26;i++){ curr.push_back(97+i); if(isposs(head,curr)){ printresult(head,query,n+1,curr); } curr.pop_back(); } }else{ curr.push_back(query[n]); if(isposs(head,curr)){ printresult(head,query,n+1,curr); } curr.pop_back(); } } int main(){ struct Trie* head=new Trie; head->wordend=false; for(int i=0;i<26;i++)head->child[i]=NULL; insert(head,"wastern"); insert(head,"waffer"); insert(head,"stat"); insert(head,"strt"); insert(head,"rakct"); insert(head,"rahct"); insert(head,"raxct"); string query; cin>>query; printresult(head,query,0,""); }
Technical Interview 1
About projects and internships DNS concepts IPV4 and IPV6 Subnet Mask Process and thread If you time platform.com then what happens in background and how it gives page content Coding ques1 write a program to find duplicate character in a string Coding question 2 write a program in C++ to reverse a string What is Rest APITechnical Interview 2
- About project
- DNS concepts
- Source and Destination address
- how to find ip address of source and destination
- Linux commands ls, PS
- private and public address
- write a code for overlapping LinkedList and how to find intersection points.
Technical Interview 3
- About your team project
- how you divided the work
- have you done any project using linux
- Question regarding your skills mentioned in CV
- Regarding your certification
- They were asking for some linux pacakages
- Your Achievements and Strengths