Two Sigma Interview Question for Software Engineer / Developers


Country: United States
Interview Type: Written Test




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

Create a dictionary out of all words.
{}

fun(array)
{
maxCount = 0;
for each word x in array
{
	count = 0
	for each word x in array	
	for( 0 <= i < x.len)
	{
		create a temp word 'y' by leaving out i'th character in x.
		if 'y' is present in dict
			if yes, count++
	}
	maxCount = max(count, maxCount);
}
return maxCount;
}

- Orion arm, Laniakea April 30, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

#include<bits/stdc++.h>
using namespace std;

set<string> dictionary_set;
int maxchain(string s,int i,int j)
{
if(i>j) return 0;
if(i==j&&dictionary_set.find(s)!=dictionary_set.end())
return s.size();
if(i==j) return 0;
int x=maxchain(s.substr(i+1,j),i+1,j);
int y=maxchain(s.substr(i,j-1),i,j-1);
int z=maxchain(s.substr(i+1,j-1),i+1,j-1);
x=x>y?x:y;
return x>z?x:y;
}

int main(){

string [] input={"a","b","ab","ac","abc"};
int max=0;
for(int i=0;i<input.size();i++)
dictionary_set.inset(input[i]);
for(int i=0;i<n;i++)
{
int x=maxchain(input[i],0,input[i].size()-1);
if(max<x)
max=x;
}
cout<<max<<endl;

return 0;
}

- lokendra2211.verma June 02, 2018 | Flag Reply


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