any one given Amzon online test recently?
Plz share quetions and interview experience.
Thanks in advance.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from
@shiva: Nice thinking, man... :)
@Yq Zhang: this similar to base 26 apporch, i have tested below code for
boundary cases ,
0, 26(z), 27(aa), 26*26(yz), 26*27(zz)
public String getColName(int id) {
char ch[] = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k',
'l',
@vivek
ur code is give true for 5
The first few numbers of series are
3, 7, 13, 31, 37, 43, 67, 73, 79, 127, 151, 163, 193.
On Mon, Aug 13, 2012 at 10:15 AM, vivek rungta vivekrungt...@gmail.comwrote:
bool is_lucky(int x){
int pos=x;
inr count=2;
while(countpos){
if(pos%count)
@All *Here is the working code: test on input {-1,5,3,-8,4,-6,9} and
{1,-1,2}*
Algo:
increment current till first +ve number(p) and decerement end till last
-ve number(n)
now consider only array between [p..n]
If current is negetive, increment current
If current is positive, swap it with end and
congrats..:)
and do share you experience..
On Sat, Aug 20, 2011 at 10:16 AM, ankur pratik ankurocks...@gmail.comwrote:
thanx to all members of algo geeks... i got a job... this goup is
awesome for any discussion
--
You received this message because you are subscribed to the Google Groups
@all
can some plz suggest the source for where i can fine the dates and news
regarding amazon off-campus Placements.
On Fri, Aug 12, 2011 at 6:36 AM, Akash Mukherjee akash...@gmail.com wrote:
Hi,
Can anyone suggest from where I should practice for the online coding round
for amazon
@Decipher
Microsoft is coming in over college.. can you Give some more question which
are recently asked ...in MS test...
@everone.. do share question of MS if some body has given the recently this
Test..
Algorithm:
1. maintain min_diff so far
2. maintain max_element so far
complexity is O(n) ,
yes O(n) solution posible..
1. traverse the first array..
2. for(i=1;i=n;i++)
{ X[a[i]] = i ;
}
3. print array X[];
On Sat, Jan 1, 2011 at 10:42 PM, Soumya Prasad Ukil
ukil.sou...@gmail.comwrote:
Is the second array really required, assuming intersection of both A B is
equal to
can some body provide Sql interview Question, for bigger companies like
Microsoft , SAP..etc..
Like here on Algogeeks we find all range of Algorithms question...
Pls suggest some links for tricky question in SQL.. and Unix(basics)..
thankyou in advance...
--
*Divesh*
(¨`·.·´¨) Always
@Nikhil
run you algo ..
on test case
index - 1 2 3 4 5
value - 1 2 3 4 5
ouput is mid+1= 3+1=4
but it should be 5...
correct me if i am wrong... and u have assumed all are positive, hence base
index should be 1
On Sun, Dec 5, 2010 at 4:41 PM, Nikhil Agarwal nikhil.bhoja...@gmail.comwrote:
If
@jai gupta
how can you find solution in O(n)
in O(n) you can just find the distance of all the points form origin..
then find the k smallest numbers(distance) in O(k log n + n ) using heap
short..
On Sun, Dec 5, 2010 at 7:28 PM, alexsolo asp...@gmail.com wrote:
use kd-tree
--
You received
@alexsolo
what is Kd-tree .. plz explain a little bit you algorithm...
On Sun, Dec 5, 2010 at 7:28 PM, alexsolo asp...@gmail.com wrote:
use kd-tree
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
@dave
plz run gene's code for input 0xAD...or send me some link of bitwise
programing which involve simultaneous many opearation... like above...
i am always confused with bitwise programing...
On Sun, Nov 21, 2010 at 11:11 PM, Dave dave_and_da...@juno.com wrote:
@Coolfrog$: Don't forget
@gene
plz explain .. what is going on... by taking example. i am unable to run
a test case
1. x=0xAD (1010 1101)
2. x1 ===01011010
|
x1 01010110
x =0100
how we will get
answer as ( 0101 1011).??
On Sun, Nov 21, 2010 at 9:59 AM, Gene
@Mukesh
indiabix.com is really a nice on for place ment...
thankyou..
keep posting such linking
On Wed, Nov 17, 2010 at 9:53 AM, Mukesh Kumar thakur
mukeshraj8...@gmail.com wrote:
try website:-.www.placementpapers.com
indiabix.com
On 11/15/10, Bittu B
@sourav
can O(n) solution possible like this
n=1245120124587412112544735685458545512522524554745669698784552
k=362541245
1. pivot = n[i] where n[i++]=k[j++] for the first time.
2.while(j= length of k[] and i= length of n[])
{if (n[i]==k[j])
{ j++;i++;
we can reduce space complexity further more by just maintaining one
array...
a[256]={0,0,0,0,0,0,0,0,0};
As character can be non numeric... all possibility in 256 ..
s[] = input string.
for( i=0;istrlen(s);i++)
{ a[ s[i] ]++;
}
for( i=0;istrlen(s);i++)
@Dave
yes im also trying to say the same point as Gene
these problem is similar to
*Least fare for a return trip Algorithm* where u have suggest
the exactly same algorithm..
@Gene do see these similar problem
[algogeeks] Least fare for a return trip Algorithm
here we have to
of step ii in to
consideration along with
a1+b3,a3+b1,a2+b3,a3+b2 ...
On Fri, Oct 15, 2010 at 8:20 PM, Dave dave_and_da...@juno.com wrote:
@Coolfrog$: You don't have to sort the arrays. You only have to find
the k smallest elements in each and sort those k entries. This can
wrong.. don't be annoyed
plz
thankyou in advance... take care..
On Sat, Oct 16, 2010 at 6:21 PM, Dave dave_and_da...@juno.com wrote:
@Coolfrog$:
1. No. It should be O(n + k log k) because finding the kth smallest
element of an array of size n is O(n), using the Median of Medians
algorithm
@Dave @Mukesh
yaa got it... so simple... i was needlessly making it complex
thankyou guys .
On Tue, Oct 5, 2010 at 2:09 AM, Dave dave_and_da...@juno.com wrote:
@Coolfrog$: It sounds like you think there are n items in each list,
but the problem statement says that the total number
@Dave
1. if three sequence given are 2,3,4,5
17,20,31,50
6,9,10,15
while running we will get 2,3,4,5 as sequence no.1 vanishes form where to
choose next element. for heap . (algo.??)
2.
Loop until
:
@Coolfrog$: There must have been a communication gap.
The initial heap consists of the first element of each sequence: 2,
17, 6.
Looping, we output 2, then replace it in the heap with 3 and restore
the heap condition: 3, 17, 6.
Output 3, replace it with 4: 4, 17, 6.
Output 4, replace
Similar to majority voting problem...
Assume there exits a majority element
As only one such element is possible...
Algo:A[1..n]
int Major(A[1..n]){
Majority=a[1];
count=1;
for(i=2;i=n;i++)
{ if(majority ==a[i])
count++;
else
{ if(count==0)
{
@ sorurav
yes , the basic logic is required so that the code can be understood in
single Run..
i also request the same to all dear friends.
Regards..
On Tue, Sep 28, 2010 at 8:11 PM, sourav souravs...@gmail.com wrote:
Hi Friends
This is an interesting problem and request you all
@Dave
very nice one line solution..
we all are revolving around x3 concept...
On Sat, Sep 25, 2010 at 10:17 PM, Dave dave_and_da...@juno.com wrote:
answer = (x || 7) + 1;
Dave
On Sep 25, 6:56 am, Krunal Modi krunalam...@gmail.com wrote:
Q: Write an algorithm to compute the next
@ Dave
can u explain ur answer...plz..
On Thu, Sep 23, 2010 at 8:55 AM, Dave dave_and_da...@juno.com wrote:
@Krunal: N = n * ceiling(log_2(n)) - 2^ceiling(log_2(n)) + 1,
where a^b is a to the power b.
Dave
On Sep 23, 8:19 am, Krunal Modi krunalam...@gmail.com wrote:
for(k=1 ;
@kartheek
i am getting. this prudent approach
but what is add what remained to the remainder.
suppose u have A,B,C,D and B is celebrity ...
if( A knows B)
{ A is not celb.
if( B knows C){}
else{ C is not celb.
if (C knows B )
{ if( D
@ umesh kewat
suppose A,B,C,D and D is celebrity
A,B C,D
how would u eliminate one form A,B even if u can ... it will be order
of O(n logn) ...
Regards ...
Divesh
On Thu, Sep 23, 2010 at 4:00 AM, umesh kewat umesh1...@gmail.com wrote:
Use divide and conquer strategy of algorithm
@Greed
in windows.. output is infinite loop and printing...
0
0
0
0
0
... infinite loop..
On Thu, Sep 23, 2010 at 9:57 AM, Greed shrishkr...@gmail.com wrote:
You can use setjmp ,longjmp or goto to get desired result.
#includestdio.h
#includesetjmp.h
void print(int v)
{
@Dave
what is the complexity of this algorithm... it given *O*(*n*(log*n*)(loglog
*n*))
but i think it should be O(n^2)
On Thu, Sep 23, 2010 at 10:39 AM, Dave dave_and_da...@juno.com wrote:
Following up to my own posting... Sorry. I answered the wrong
question, What is the sum of the first
@nishaanth
for n=1 N=0 as k=1 and kn not k=n
for n=2 N= 0+1
for n=3 N=0+1+3
so formula is correct .. i have checked twice
@Dave :
very nice but... how u approached while solving
On Thu, Sep 23, 2010 at 12:29 PM, nishaanth nishaant...@gmail.com wrote:
@Davefor n=2 ur formulae
@aswath :
nice solution... very simple too.
it gives the desired solution as required..though it is a case of indirect
recursion... but still a nice aproach...
keep it up
thanks.
Regards
Divesh
On Thu, Sep 23, 2010 at 12:45 PM, aswath G B aswat...@gmail.com wrote:
#includestdio.h
char* temp, temp2;
char* s=Nitin;
for(temp2=s;*temp2='\0';temp2++ );/*just to calculate the length of s*/
void strrev(char * s,char* temp2)
{ if (s==temp2 ||stemp2)
{return;}
*temp = *s;
*s=* temp2;
*temp2=*temp;
temp2++;
s++;
strrev(*s,*temp2)
}
But it is
;}
*temp = *s;
*s=* temp2;
*temp2=*temp;
temp2++;
s++;
strrev(*s,*temp2)
}
On Thu, Sep 23, 2010 at 1:15 PM, coolfrog$
dixit.coolfrog.div...@gmail.comwrote:
char* temp, temp2;
char* s=Nitin;
for(temp2=s;*temp2='\0';temp2++ );/*just to calculate the length of s*/
void
@nishant:
what is i and j..???
@
On Thu, Sep 23, 2010 at 1:20 PM, Nishant Agarwal
nishant.agarwa...@gmail.com wrote:
void xstrrev(char *s , int i , int j)
{
char t;
if(ij)
{
t=s[i];
s[i]=s[j];
s[j]=t;
xstrrev(s,i+1,j-1);
}
}
On Thu,
);
xstrrev(s,0,strlen(s)-1);
puts(s);
return 0;
}
On Fri, Sep 24, 2010 at 12:15 AM, coolfrog$
dixit.coolfrog.div...@gmail.com wrote:
@nishant:
what is i and j..???
@
On Thu, Sep 23, 2010 at 1:20 PM, Nishant Agarwal
nishant.agarwa...@gmail.com wrote:
void xstrrev(char *s
that it's a difficult prob to
solve. Point lies in working with the design to make this close to log
n.
Define what value const holds.
On Sep 21, 9:12 am, coolfrog$ dixit.coolfrog.div...@gmail.com
wrote:
its dictionary means shorted ordered arry.
let low = 1; and high= const.(10
solution in o(n log n)
can be ( as if solution exit only one element cam be a majority element in
the given array)
1. sort the array in O(nlogn)
2. x = a[2n/3]
if(a[0]==x)
{ if(x== a[(2n/3])+1)
return (x)
}
On Wed, Sep 22, 2010 at 5:53 AM, Dave
...@gmail.comwrote:
@coolfrogs: How can more than one element exist of 2n/3 times repeated..
@dave: can u add that for loop and send as i tried but could not succeed
On Wed, Sep 22, 2010 at 6:23 PM, coolfrog$
dixit.coolfrog.div...@gmail.com wrote:
solution in o(n log n)
can be ( as if solution exit only
its dictionary means shorted ordered arry.
let low = 1; and high= const.(10^const)
Boolean isWord(String word)
{ while(low = high)
{ mid = (low+ high)/2;
if(word = getWordAt(mid))
return true;
if( word getWordAt(mid))
There is a 2 dimensional array with each cell containing a 0 or 1 ,
Design an algorithm to
find out which row has the maximum number of 1's , Your algorithm should
have O(n2)
time and no space complexity.
--
You received this message because you are subscribed to the Google Groups
Algorithm
42 matches
Mail list logo