Register | Login

Published News » Programming Questions

Given an Array With random 0s and non 0 numbers, shift all the 0s to the beginning and non 0s to the rear.
Eg: 1,9,8,4,0,0,2,7,0,6,0
Out put 0,0,0,0,1,9,8,4,2,7,6
i.e order of numbers not to change. Do it in place
"Let's play a game of Russian roulette*", begins one interview stunt that is going the rounds at Wall Street investment banks.
I'm listing bellow some examples of interview questions that check the knowledge of the candidate based on his/her experience

Like me, many have a love/hate relationship with JavaScript. Now a days, JavaScript is very popular with the rich internet applications (RIA). So, it really pays to know JavaScript. JavaScript
Two very large numbers are represented using arrays. Multiply these two numbers. E.g. Two numbers 12 and 13 are represented as a=[1,2] adn b=[1,3]. The expected result is 12*13=156 i.e. c=[1,5,6]
let f(n, k) be the # of ways of choosing k integers without replacement from
n consecutive integers so that no two selected are consecutive.
Given a set of numbers [1-N] . Find the number of subsets such that the sum of numbers in the subset is a prime number. This looks like a Dynamic Programming Problem
Given a very long list of URLs, find the first URL which is unique
Design an algorithm that, given a list of n elements in an array, finds all the elements that appear more than n/3 times in the list.
The algorithm should run in linear time. (n >=0 )
You are expected to use comparisons and achieve linear time. No hashing/excessive space/ and don't use standard linear time deterministic selection algo
Design an algorithm that, given a list of n elements in an array, finds all the elements that appear more than n/3 times in the list.
The algorithm should run in linear time.
You are expected to use comparisons and achieve linear time.
Suppose you have an NxN matrix of positive and negative integers. Write some code that finds the sub-matrix with the maximum sum of its elements

Interview Question: Find the Missing Number

Posted by csguy (#13) 544 days ago (Editorial)
An array A[1 . . n] contains all the integers from 0 to n except one. It would be easy to determine the missing integer in O(n) time by using an auxiliary array B[0 . . n] to record which numbers appear in A. In this problem, however, we cannot access an entire integer in A with a single operation. The elements of A are represented in binary, and the only operation we can use to access them i
Write a method to randomly generate a set of m integers from an array of size n. Each element must have equal probability of being chosen

Interview Question: next Permutation

Posted by csguy (#13) 548 days ago (Editorial)
Given a number,find the next higher number using the same digits in the number. Eg- 15432, Soln- 21345.
The algorithm I developed was simple. Starting at tile x, a list x is generated containing all of the possible values tile x could assume without interfering with its relevant non-empty neighbors, where neighbors refers to tiles in the same row, column and sub-grid as tile x. If tile x has a predefined value that must be solved around, that is tile x's only valid value. Tile x then assumes a valu

Find the Majority Element

Posted by indian1 (#2) 550 days ago (Editorial)
Given an array A[]. Frequency of one of the element is greater than size of A. How will you find the majority element in O(n)

Next Palindrome Interview Question

Posted by admin (#43) 550 days ago (Editorial)
A positive integer is called a palindrome if its representation in the decimal system is the same when read from left to right and from right to left. For a given positive integer K write a program to find the value of the smallest palindrome larger than K to output. Numbers are always displayed without leading zeros.


Idea:

For Even Numbers

1234 - 1221 - Copy leftside to right and see

Product of all Elements Except One

Posted by csguy (#13) 551 days ago (Editorial)
Given an Arrays A[]. Find a new array B[] of same length N with each element B[i] = Product of all elements of A except A[i].
Example A = {1,2,3}
B={6,3,2}

Dictionary Word with Minimum Edit Distance

Posted by csguy (#13) 551 days ago (Editorial)
How will you implement a spell checker algorithm.
Given a word and a dictionary propose and algorithm to get the word in dictionary which has least edit distance from the given word.

Find Conflicts in Schedule

Posted by csguy (#13) 552 days ago (Editorial)
Given 'n' appointments each having a startime and an endtime. Retun all conflicting appointments
Sort News
Username:

Password:

Remember:
Indian Social News and Links Network