Tagged Questions
67
votes
15answers
4k views
Searching an element in a sorted array
I was applying for a position, and they asked me to complete a coding problem for them. I did so and submitted it, but I later found out I was rejected from the position. Anyways, I have an eclectic ...
16
votes
10answers
2k views
Find all the missing number(s)
Recently I've attended an interview, where I faced the below question:
Question: "There is an sorted array. You need to find all the missing numbers. Write the complete code, without using any ...
14
votes
6answers
1k views
Array whose values are the product of every other integer
I was asked the following interview question over the phone:
Given an array of integers, produce an array whose values are the
product of every other integer excluding the current index.
...
13
votes
4answers
527 views
Finding the sub-array with the maximum sum - my approach
This is the code I ended up with that implements the approach I described in a recent answer to another question about the same problem
The basic idea here is to not loop through more things than ...
7
votes
4answers
526 views
Find the subarray with the max sum
In an interview I was asked to solve the following problem:
find a subarray with max sum
I have written a piece of code for the same. I need your help in reviewing this code.
...
6
votes
2answers
441 views
Generating a list of alternatively positioned odd and even number out of an array of unsorted integers
I had an half an hour interview with Microsoft for an intern position. I was asked to generate a list of alternatively positioned odd and even number out of an array of unsorted integers. I guess it ...
6
votes
1answer
62 views
Finding the sub-array with maximum sum - my slow approach
I decided to give the maximum sub-array sum problem an interesting go, however I will assure you that it doesn't perform well, and that I would never put this in production.
I'd like a review on ...
5
votes
3answers
1k views
Find elements occurring even number of times in an integer array
I came across an interview question, which is like this:
You have an array of integers, such that each integer is present an odd number of time, except 3 of them. Find the three numbers.
I tried ...
4
votes
2answers
177 views
Finding the value 'n' in an array that has 'n' or more larger values
Given an unsorted array of integers, you need to return maximum possible \$n\$
such that the array consists at least \$n\$ values greater than or equals
to \$n\$. Array can contain duplicate ...
4
votes
2answers
2k views
Max repeated word in a string
I was trying to do a very common interview problem "Finding the max repeated word in a string " and could not find much resources in net for c/c++ implementation. So I coded it myself here. I have ...
2
votes
3answers
27 views
Find two unique integers in sorted array
I have to write the following method: I have sorted array of integers and in this array every integer repeats twice, except two elements. Find these two elements.
Input: 1, 1, 2, 3, 3, 4, 4, 5
...