-> means writes into.
- means numerical subtraction
There are three operations supported on three registers:
A->R
B->R
A-R->A
----------------------------
A=5, B=3
Transfer the contents of B to A. Finally A should contain 3.
Normal interview puzzle
##########################################
There is a unique number of ten digits, for which the following holds:
* all digits from 0 up to 9 occur exactly once in the number;
* the first digits is divisible by 1;
* the number formed by the first two digits is divisible by 2;
* the number formed by the first three digits is divisible by 3;
* the number formed by the first four digits is divisible by 4;
* the number formed by the first five digits is divisible by 5;
* the number formed by the first six digits is divisible by 6;
* the number formed by the first seven digits is divisible by 7;
* the number formed by the first eight digits is divisible by 8;
* the number formed by the first nine digits is divisible by 9;
* the number formed by the ten digits is divisible by 10.
give the solution with details.
There is a unique number of ten digits, for which the following holds:
* all digits from 0 up to 9 occur exactly once in the number;
* the first digits is divisible by 1;
* the number formed by the first two digits is divisible by 2;
* the number formed by the first three digits is divisible by 3;
* the number formed by the first four digits is divisible by 4;
* the number formed by the first five digits is divisible by 5;
* the number formed by the first six digits is divisible by 6;
* the number formed by the first seven digits is divisible by 7;
* the number formed by the first eight digits is divisible by 8;
* the number formed by the first nine digits is divisible by 9;
* the number formed by the ten digits is divisible by 10.
give the solution with details.
Difficult One
##########################################
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.
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.
Google question
given an array of n integers A[n]
find maximum and second maximum element in N+logN comparisons
find maximum and second maximum element in N+logN comparisons
SOLVED:Linked list
In a linked list U have to delete the Node XXX , XXX->link and XXX->info is given
void delete ( NODE XXX ){
----fill u r code here----
}
ANSWER IS THERE IN COMMENTs ,still u can add ur answer .
void delete ( NODE XXX ){
----fill u r code here----
}
ANSWER IS THERE IN COMMENTs ,still u can add ur answer .
SOLVED:some Good questions
Let x,y,z be 3 integers . We have to find the greatest of 3 integers, without using relational and conditional operator?
ANSWER IS THERE IN COMMENTs ,still u can add ur answer .
ANSWER IS THERE IN COMMENTs ,still u can add ur answer .
Subscribe to:
Posts (Atom)