Wireless Generation Interview Question for Software Engineer / Developers

• 0

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

The question is confusing. Please rephrase it or make it clear with an example.

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

I guess he probably means that we are given with an array of integers and a number,say x. And we have to find whether some of the numbers in that array can be combined to sum up to the given number x.

Please correct me if I am wrong!
And regarding the algo still thinking about it!!

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

Mohit,
you are right.

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

generate a power set of the array and then at every step of generation sum it up to see if it adds up to the required sum.

very poor approach though as the complexity is 2^n.

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

use a Harshtable and the complexity could be O(n). Just check for each integer a, find if x-a is in the harshtable

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

I had the same answer as gang did.

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

This is not a 2-sum problem! It's asking ANY combination, not just two integers.

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

Assuming the list contains all positive integers

``````1) Sort the list  --> O(nlg(n))
algo():
1) for i =0 to len(list)
2)    for j = i+1 to len(list) #here key is the element
3)        if(list[i]+list[j] > key)
4)              break
5)        else if (list[i]+list[j] == Key)
6)              print i,j
7)    end for
8) end for``````

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

I guess as we have to check every combination worse case of O(n^2) will always be, there,,,

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

check this 12 34 54 -16 23 4 65

if I need to have sum 57

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

guys - any thought on this??

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

Yeah, O(n^2) is the only way to do this

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

I do not understand how two of the following mean the same (or what the original question means)? The original question does not make any sense.

1. give you a set of points and a 3-D matrix;identify if any comb in the set is equal to the square plane.
2. I guess he probably means that we are given with an array of integers and a number,say x. And we have to find whether some of the numbers in that array can be combined to sum up to the given number x.

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

I do not understand how two of the following mean the same (or what the original question means)? The original question does not make any sense.

1. give you a set of points and a 3-D matrix;identify if any comb in the set is equal to the square plane.
2. I guess he probably means that we are given with an array of integers and a number,say x. And we have to find whether some of the numbers in that array can be combined to sum up to the given number x.

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

any help?

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

no one here?

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

no one here?

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.

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.