##########################################
There is an array (say 'A') with 'n' (n >= 3) distinct positive integers.
There is an array 'B' with n*(n-1)/2 elements which represents the sum of all the possible pairs of two numbers of the array
Example
A = Set of Distinct +ve Integer = {12,2,3,1}
B = Set of sum of any two elements of A = {12+2,12+3,12+1,2+3,2+1,3+1} = {14,15,13,5,3,4}.
Now, if you are given the array B, get the array A.
interview question
########################################
There are numbers from 1 to N in an array. out of these, one of the number gets duplicated and one is missing. The task is to find out the duplicate number. Conditions: you have to do it in O(n) time without using any auxiliary space (array, bit sets, maps etc..)
There are numbers from 1 to N in an array. out of these, one of the number gets duplicated and one is missing. The task is to find out the duplicate number. Conditions: you have to do it in O(n) time without using any auxiliary space (array, bit sets, maps etc..)
puzz1-pendulum
########################################
If a pendulum clock take 2 seconds to give 2 bells when it’s a 2’O Clock.
How many seconds it will take to give 3 bells when it is 3’ O clock?
If a pendulum clock take 2 seconds to give 2 bells when it’s a 2’O Clock.
How many seconds it will take to give 3 bells when it is 3’ O clock?
Inserting a node before the pointer in linked list
########################################
Insert a new node to a link list when u dont know pointer to the starting node. Let u have a pointer P and u have to insert a node before that node.and P is not the starting node.
Insert a new node to a link list when u dont know pointer to the starting node. Let u have a pointer P and u have to insert a node before that node.and P is not the starting node.
SOLVED : Swap two variable
SOLVED:-How to swap 2 variable values without using a temp(3rd) variable.
Subscribe to:
Posts (Atom)