You are given an array of integers, a1, that have sequential integers 1 through n. ( { 1,2,3,4,5 } or { 1,2,3 } or any other array) You are also given an array of integers, a2, that also have numbers 1 through n, but are not in sequential order and are missing one of the numbers between 1 and n. Find the missing number in a2. Did you check for special cases? Can you do this in O(n) runtime?
Software Developer Fresher Interview Questions
96,187 software developer fresher interview questions shared by candidates
Swap two variables without using a temp.
Jim has 42 cents and has 8 coins, and Jack has 56 cents and has 6 coins. Which has more nickels than the other?
Puzzle1 - Given 8 coins, and the fact that one of the coins is heavier than the other, how many times(min) do you need to use a beam balance to figure out which is the anomalous coin? After I answered this, he made it little tougher. Given 9 coins and one anomalous coin(maybe heavier or lighter), figure out which coin it is and whether heavier or lighter. What is the min no of comparisons? This is where i took a while to answer.
Why Accenture?
1. Given a string, find the smallest window with greatest no. of distinct characters 2. k sorted array. 3. longest distance between a node and its ancestor.
You have words separated by white spaces. You need to reverse their order in place.
After i got selected they are demanding money.
Given a list of integers A and an integer k, return the number of unique pairs of integers in A that sum to k. For example, if A=[1 2 5 5 10 8 2] and k=10, the answer is 2, arrived as 5+5 or 2+8. There were 15 tests for this question, with at least the last two timing out, given that the implementation was not as efficient as possible.
/* * Suppose we have a sorted array in ascending order, with no duplicates: * * {1, 2, 3, 4, 5, 6, 7} * * Somehow an unknown amount of numbers at the beginning are shifted to the end, * creating an array that looks like: * 0 1 2 3 4 5 6 * {3, 4, 5, 6, 7, 1, 2} * * Let us call the new array a shifted cyclic array. * * Now, given a Shifted Cyclic Array int a[], and its length n (> 0), write a function * to find the smallest number in the array. */
Viewing 91 - 100 interview questions