Topic — Add New » Posts Last Poster Freshness
sorting 2 kartik 1 week

Q. write an algorithm to sort the n element of an array having element 1 to n , without using extra static variable ,global variable ,any extra space like other array?

maximum number of people in a party 1 alp 3 weeks

There is a list containing the checkin and checkout time of every person in a party . The checkin time is in ascending order while the checkout is random .
Eg:

                       Check_in                Check_out
Person 1             8.00                          9.00
Person 2             8.15                          8.30
Person 3             8.30                          9.20

and so on ...Now , give an optimized solution to find at what time the maximum number ...

Playing with memory 1 Vanathi 1 month

Playing with memory

Sindhu and Alistair play a memory game involving of a sequence of random
numbers between 1 and 10, inclusive, that is called out one at a time.

Each player can remember up to 5 previous numbers. When the called
number is in a player's memory, that player is awarded a point. If it's not,
the player adds the called number to his memory, removing another number
if his memory is full.

Both players start with empty memories. Both pla...

Microsoft Interview Question for Software Engineer/Developer about Strings 7 1 month

compress the given string
eg. aaabbcccaadee
o/p = a3b2c3de2

Microsoft
Question in recruitment examination of Microsoft for SDE 5 Pavithra 1 month

Multiply all the elements of A[] and store the output in an aray out[], and the element at out[i] should be the output of all elements of A[] except A[i]

find the element appearing n times in an array of 2n elements 17 Tyson 1 month

Given an array of 2n elements of which n elements are same and the remaining n elements are all different. Write a C program to find out the value which is present n times in the array

Software Engineer 3 Dixit Sethi 1 month

[b] write an algorithm to compute the number of possible path(permutation based on the position of knight) to a Knight in the given board.
Initial position of knight is at '0'[/b]

 given board

   1   2  3
   4   5  6
   7   8  9
        0

int findNoOfPaths(board b, initial position){
   --
    --
}

example: the number of possible paths/permutation of length 1(one) is=2{04,06}
the number of possible paths/permutation of length 2(two) is 6={043,049,040,067...

Max sum pairs 3 Jeff 1 month

Max Sum pair
Given two sorted postive integer arrays A(n) and B(n) (W.L.O.G, let's say they are decreasingly sorted),

we define a set S = {(a,b) | a \in Aand b \in B}.

Obviously there are n^2 elements in S. The value of such
a pair is defined as Val(a,b) = a + b. Now we want to get the n pairs from S with largest values. The tricky part is that we need an O(n) algorithm.

This question is not my inovation. I have copied it here from other forum. COZ it worth di...

Compare lists and get top pairs 2 kartik 2 months

I have many lists which each one have 6 elements. I want to compare them and get top pairs.

List 1 => 1 4 5 6 5 7
List 2 => 2 3 8 6 1 9
List 3 => 4 7 1 3 5 6

Top Pairs
========
1,6 - 3 times
1,5 - 2 times
4,5 - 2 times

How to do this efficiently?

Microsoft - Find the number of ways of placing 3 balls in 3 buckets 3 Prateek Caire 2 months

Find the number of ways of placing 3 balls in 3 buckets. buckets are of diff capacity.
bucket1 can hold 2 balls
bucket2 - 3 balls
bucket3 - 2 balls.

ex. 1 1 1 is valid
0 3 0 is valid

Travelling Salesman Problem 1 Raj kumar 2 months

find minimum number of trip in Travelling Salesman Problem when weight of the links are not given?

Balanced 0-1 matrix 3 3 months

Given an n*n matrix --->in how many ways we can fill n/2 0 and n/2 1 in each and every column....!!

Neither Max nor Min 5 srikantaggarwal 3 months

Suppose a double Dimension array is given of order N x N . And it is filled with distinct elements . Now you have to find the atleast one row which neither contain the maximum or the minimum element among all the elements present . The runtime complexity should be less than O(N^2) .

knight's minimum moves on a chessboard 4 3 months

1) What can be the algorithm for finding the minimum moves path from one box to a destination box in chess board.

Check repitition of number in an Array 6 Saurya 3 months

Given an array , say abc[10]..
10 numbers are entered by user..
only one number is repeated..
we have to output that repeated number...
Please help me out in finding a nice algorithm for this.

Choose numbers from sets such that their sum is equal to P 1 3 months

There are K sets. Each set can contain n numbers from 0 to n. we've to choose exactly one number from each set auch that the sum of all the elements that we chose should be equal to P. we have to find how many such possibilities are there to choose so..

for example
assume there are 3 sets containing 1,2,3 elements in them
so the first set contains 0 and 1
second set contains 0,1 and 2
third set contains 0,1,2 and 3

assume P=2

in this case ther...

Sort an array which is already sorted in two parts 8 3 months

Given an array with two subparts sorted. How will you make a final sorted array.

i/p:
1, 5, 7, 9, 11, 23, 2, 3, 8, 9, 21

o/p:
1, 2, 3, 5, 7, 8, 9, 9, 11, 21, 23