Honeywell Interview Question for Software Developers


Country: India
Interview Type: In-Person




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

cat file1.txt | sed 's/.*/grep -q "&" file2.txt \|\| echo "&"/' | bash

- srterpe December 09, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

The task requires: "Need efficient algorithm to do this".
And this is just a unix command, but what algorithm is behind it?
I suppose it is something like as described above.

- zr.roman December 09, 2015 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Is there anyway to do it in windows7?

- Anonymous December 09, 2015 | Flag
Comment hidden because of low score. Click to expand.
1
of 1 vote

Complexity : O(n)

#include <iostream>
#include <unordered_set>
#include <string>
#include <vector>

using namespace std;

int main() {
	vector<string> v1 {"Raja Uthaya", "Antony Karthi" 
	,"Christopher Raja","Manickam Antony" ,"Veeramani", "Chinmay Garg" };
	vector<string> v2 {"Antony Karthi" 
	,"Christopher Raja","Veeramani" };
	unordered_set<string> s1 (v1.begin(), v1.end());
	unordered_set<string> s2 (v2.begin(), v2.end());

	for(auto it : s2) {
		if(s1.find(it) != s1.end()) {
			s1.erase(it);
		}
	}

	for(auto it : s1) {
		cout << it << endl;
	}

	return 0;
}

- Chinmay Garg April 24, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Put everything in file2 into a hashtable. Then go through file 1, and check if the name matches to a key for file2 hashtable

- Anonymous December 08, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

careercup has bug with displaying answers.
If I saw your answer I would not post mine.
The idea is common.

- zr.roman December 08, 2015 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Put all the names from 2.txt into hashset (of hashtabe, in general - into structure with O(1) access).
Perform a loop against "1.txt".
In a loop: if hashset.Contains( <current word from 1.txt> ), then continue. Otherwise - display it on screen.
O(n + m), where n - number of names in 1.txt., m - number of names in 2.txt.
But, as the task says m << n, then asymptotic complexity O(n).

- zr.roman December 08, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Add all the contents of file one and two into two different list. And use the list inbuilt method List1.removeAll(List2) , what left out in the first list will be the non repeated elements from list1.

- mail.shinev December 21, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

what if we sort the two lists,
then

for(i=0;i<m;i++){
	for(;j<n;j++){
		if(b[i]!=a[j])
			cout<<a[j];
	}
    }

it still remains O(n)

- random May 04, 2016 | 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