It's great to see this group active after such a long time, though it was
not for discussing an algo, but I think it's fine if a member in the group
needs some help in his/her professional career and asks for the same here.
Many members in this group are in this industry from more than a decade or
Hello, guys!
Have a nice day. Greetings from Russia.
пт, 16 июл. 2021 г., 09:19 Himanshu Singh :
> Hello Guys,
>
> Sorry to say pls stop spamming whole group.
>
> Thanks.
>
>
> On Fri, Jul 16, 2021, 11:46 AM Yash Khandelwal <
> khandelwalyash...@gmail.com> wrote:
>
>> Done kindly check the mail
Hello Guys,
Sorry to say pls stop spamming whole group.
Thanks.
On Fri, Jul 16, 2021, 11:46 AM Yash Khandelwal
wrote:
> Done kindly check the mail
>
> On Fri, Jul 16, 2021, 11:41 AM immanuel kingston <
> kingston.imman...@gmail.com> wrote:
>
>> Please send a note to me on king...@amazon.com
Done kindly check the mail
On Fri, Jul 16, 2021, 11:41 AM immanuel kingston <
kingston.imman...@gmail.com> wrote:
> Please send a note to me on king...@amazon.com
>
> Thanks,
> Kingston
>
> On Fri, Jul 16, 2021 at 11:16 AM immanuel kingston <
> kingston.imman...@gmail.com> wrote:
>
>> Hi all,
>>
Please send a note to me on king...@amazon.com
Thanks,
Kingston
On Fri, Jul 16, 2021 at 11:16 AM immanuel kingston <
kingston.imman...@gmail.com> wrote:
> Hi all,
>
> I am a hiring manager at Amazon. We are hiring for SDE and Applied Science
> roles in my team. Please send a short note about
Counting sort does not run in O(1) space though. Optimally it will run in
O(K) space, where A is an array of integer numbers and K = max(A) - min(A)
On Saturday, February 9, 2013 9:52:01 PM UTC-5, Mohanabalan wrote:
can use counting sort
On Sun, Jul 15, 2012 at 6:37 PM, santosh thota
A bit vector is basically just a sequence of bits such as a word or even an
array of words. Here is an example...
int x = 5; // 32 bit word size on Intel IA-32 Architecture In C
programming language.
A variable in C will be either located in a register in memory or in Main
Memory. You
This will only work if each element in the array are relatively prime to
one another, that is for any two elements x, y in array A the gcd(x,y) = 1,
which is also just another way of saying no number divides another number
in the array. Once this rule is broken, then
the algorithm will no
use XOR
On Tue, Apr 30, 2013 at 6:12 AM, Gary Drocella gdroc...@gmail.com wrote:
This will only work if each element in the array are relatively prime to
one another, that is for any two elements x, y in array A the gcd(x,y) = 1,
which is also just another way of saying no number divides
:O the final required sum would be 4C0 * a5 - 4C1 * a4 + 4C2 * a3 - 4C3 *
a2 + a1 how ? , did i missed something id yes can you paste the link or
explain ?
Thanks
Shashank
On Wednesday, April 10, 2013 5:09:41 AM UTC+5:30, Shachindra A C wrote:
Consider n = 5. Naming the array elements as
in this Problem if the array is
A[n] = {a0,a1,a(n-1),a(n)}
after the second iteration,
the value will be
{a0 -2*a2+a3, a2 -2*a3 + a4, a3-2*a4+a5,, a(n-2)-2a(n-1)+a(n)}
if we add all these terms then
all the middle elements will be canceled out so the remaining will be.
{a0-a2 -
On 4/13/13 10:05 PM, pankaj joshi wrote:
in this Problem if the array is
A[n] = {a0,a1,a(n-1),a(n)}
after the second iteration,
the value will be
{a0 -2*a2+a3, a2 -2*a3 + a4, a3-2*a4+a5,, a(n-2)-2a(n-1)+a(n)}
if we add all these terms then
all the middle elements will be canceled
It is O(N^2) because the inner loop takes N steps to execute and that
loop will be executed N times.
However, I would suggest not using recursion. There is no reason to
not do it iteratively. Your recursive solution has no base case so it
will recurse until your computer runs out of stack space,
i forgot to add base case..can add wen 2 elemnts are there then there sum
is stored and we reurn from there...i m in hurry,,,sry for that,,
On Wed, Apr 10, 2013 at 12:11 AM, Don dondod...@gmail.com wrote:
It is O(N^2) because the inner loop takes N steps to execute and that
loop will be
If you have any other solution ..please post that...i thnik recursion is ok
with base case...we need to scan again after first iteration...??
On Wed, Apr 10, 2013 at 12:12 AM, rahul sharma rahul23111...@gmail.comwrote:
i forgot to add base case..can add wen 2 elemnts are there then there sum
int getsum(int *a, int n)
{
while(--n)
{
for(int i = 0; i n; ++i)
a[i] = a[i+1] - a[i];
}
return a[0];
}
I'm not really clear about how it is intended to work. It seems that
if you start with an array of N values, each iteration reduces the
number of values by 1, so
Recursion and iteration don't differ in this algorithm. But avoid using
recursion if same can be done using iteration. In practical cases, system
does not allow very large depth in recursion. So for large values of n,
there can occur segmentation fault.
On Tue, Apr 9, 2013 at 11:43 AM, rahul
Consider n = 5. Naming the array elements as a1,a2,a3,a4,a5 , the final
required sum would be 4C0 * a5 - 4C1 * a4 + 4C2 * a3 - 4C3 * a2 + a1.
That is nothing but the pattern of a binomial expansion. Using this method,
the complexity can be reduced to O(n).
Correct me if I'm wrong!
On Tue, Apr
On 4/10/13 12:13 AM, rahul sharma wrote:
If you have any other solution ..please post that...i thnik recursion
is ok with base case...we need to scan again after first iteration...??
First of all, the array size and number of iteration both won't be N or
else the answer will always be 0.
I take
hi sourab please explain what bit vector1 and bit vector 2 really are can
you give an example please?
On Saturday, February 16, 2013 11:20:59 PM UTC+5:30, sourabh wrote:
you can solve this problem using bitvector/bitset.
first scan :
scan the array set the bit on odd occurrence and unset on
@sandeep he is talking about constant space.
On Tue, Mar 19, 2013 at 5:31 PM, sandeep kumar
sandeepkumar1...@gmail.comwrote:
Hey what if while scanning through the array we create a BST n check
simultaneously that :
current node == current node's parent current node == current node's
left
Hey what if while scanning through the array we create a BST n check
simultaneously that :
current node == current node's parent current node == current node's
left or right child
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To
Ans to *Boundary traversal of a tree. Write the code.
*1) you need to for preoder oder for left most tree with flag and post
order traversal for right most tree with flag.
2) the role of flag would be to decide wther to print or not like in case
of left subtree ,flag would be tree as u knw that
i have few questions regarding ur problems pratik :
1) A tree with only parent pointer, how to find LCA?
Doubt : do u mean only root of the tree is given , i am assuming root along
with two nodes address whose lca need to
find too is given , i am right ?
2) Find top k searched elements
these questions were asked for software dev. in amazon ? which round .
looks like straight easy questions...
On Sun, Mar 10, 2013 at 5:58 PM, Nishant Pandey
nishant.bits.me...@gmail.com wrote:
Ans to *Boundary traversal of a tree. Write the code.
*1) you need to for preoder oder for left
It looks as if you have just pasted some Amazon interview questions on this
forum.
These are pretty common questions.
Try to come up with your own answers.
Do some research on google and previous posts on this forum. You'll get
answers to all of them.
If you have some idea and want to discuss
Yes, thats a valid point Don.
Thats what i meant when i wrote //is that correct? in the comments on
the array line in code.
int a[] = {2,2,3,3,3,1,1,4,4}; // is this correct?
On Wed, Feb 13, 2013 at 9:09 PM, Don dondod...@gmail.com wrote:
The xor approach only works if there are no values
you can solve this problem using bitvector/bitset.
first scan :
scan the array set the bit on odd occurrence and unset on even or
0 occurrence.
second scan :
shift all the odd occurring elements in beginning of array and even towards
end.
third scan : till end of odd occurring elements.
take
Sachin Chitale,
Dude the xoring operation will give us xor of numbers with freq 1 and 3
respectively. How do you filter out the number with the frequency 3??
On Tuesday, February 12, 2013 11:44:08 PM UTC+5:30, Sachin Chitale wrote:
use ex-or operation for all array elements..
a^a=0
a^a^a=a
Search for BitSet/BitVector in java .
On Tue, Feb 12, 2013 at 11:44 PM, Sachin Chitale
sachinchital...@gmail.comwrote:
use ex-or operation for all array elements..
a^a=0
a^a^a=a
On Sun, Feb 10, 2013 at 8:22 AM, Mohanabalan D B
mohanabala...@gmail.comwrote:
can use counting sort
On
@Sachin Chitale : Very good approach dude .
thumbs up +1
--
Arun Singh Chauhan
Engineer (RnD 2), Samsung Electronics
Software Engineering Lab, Noida
On Tuesday, February 12, 2013 11:44:08 PM UTC+5:30, Sachin Chitale wrote:
use ex-or operation for all array elements..
a^a=0
a^a^a=a
On
The xor approach only works if there are no values which occur only
once. But the problem statement indicates that some numbers occur
once, some occur twice, and one occurs three times. So you will end up
with prod equal to the xor of all of the values which occur once or
three times. Put that in
can use counting sort
On Sun, Jul 15, 2012 at 6:37 PM, santosh thota santoshthot...@gmail.comwrote:
If we can retrieve ith prime efficiently, we can do the following...
1.maintain a prod=1, start from 1st element, say a[0]=n find n th prime
2.check if (prod% (ith_prime * ith_prime )==0) then
Thanks all for solutions, but this problem can also be solved using DP
right ???
On Wednesday, 16 January 2013 01:57:26 UTC+5:30, Don wrote:
Sprague–Grundy theorem
On Jan 12, 6:28 pm, Nguyễn Thành Danh danhnguyen0...@gmail.com
wrote:
Can you please explain by which theorem you use to
Sure, but why? The solution is n%3. DP will by more complex and
slower.
On Jan 16, 11:43 am, siva sivavikne...@gmail.com wrote:
Thanks all for solutions, but this problem can also be solved using DP
right ???
On Wednesday, 16 January 2013 01:57:26 UTC+5:30, Don wrote:
Sprague–Grundy
Ya I'm aware, Just wanted to confirm. Suppose if the problem can't be
reduced to a mathematical formulae , then DP must be the reliable solution
for this kind of problems.
That's why wanted to know exact DP solution also..
On Wednesday, 16 January 2013 22:42:52 UTC+5:30, Don wrote:
Sure, but
The DP solution is to mark the winning position as winning. Then mark
any positions which can move to a winning position as losing and the
rest as winning.
On Jan 16, 12:21 pm, siva sivavikne...@gmail.com wrote:
Ya I'm aware, Just wanted to confirm. Suppose if the problem can't be
reduced to a
This is a impartial game similar to *Take Away Game* that can be solved
using game theory.
solution of *lucifier* is correct.
On Wed, Jan 16, 2013 at 1:57 AM, Don dondod...@gmail.com wrote:
Sprague–Grundy theorem
On Jan 12, 6:28 pm, Nguyễn Thành Danh danhnguyen0...@gmail.com
wrote:
Can you
Are these openings for present final year students(2013 batch) as well???
regards
Abhishek
On Tuesday, 15 January 2013 16:47:01 UTC+5:30, sahil madaan wrote:
Hi all,
There are multiple openings for SDE1 and SDE2 for Amazon hyderabad and
Bangalore location. Interested candidates please send
Are they opening for interns as well?
On Tuesday, January 15, 2013 4:47:01 PM UTC+5:30, sahil madaan wrote:
Hi all,
There are multiple openings for SDE1 and SDE2 for Amazon hyderabad and
Bangalore location. Interested candidates please send your resume to
sahilma...@gmail.com
Can you please explain by which theorem you use to find out that?
On Sat, Jan 12, 2013 at 11:41 AM, Lucifer sourabhd2...@gmail.com wrote:
if (n%3 == 0)
Player 1 will lose
else
Player 1 will win. The no. of balls picked in the first turn will
be n%3
--
Sprague–Grundy theorem
On Jan 12, 6:28 pm, Nguyễn Thành Danh danhnguyen0...@gmail.com
wrote:
Can you please explain by which theorem you use to find out that?
On Sat, Jan 12, 2013 at 11:41 AM, Lucifer sourabhd2...@gmail.com wrote:
if (n%3 == 0)
Player 1 will lose
else
If it is your turn and there are 1 or 2 balls in the basket you take
them and win.
If it is your turn an there are 3 balls in the basket, you must leave
1 or 2 after your turn, so you lose.
If the number of balls on your turn is not divisible by 3, you can
take 1 or 2 balls and make it divisible
This problem was a team challenge in Survivor Amazon, except they were
allowed to take 1,2,3, or 4 flags. The winning strategy is to leave a
multiple of 5 flags. But none of the contestants figured it out.
Don
On Jan 12, 8:03 am, siva sivavikne...@gmail.com wrote:
consider there are N balls in a
@siva..
if (n%3 == 0)
Player 1 will lose
else
Player 1 will win. The no. of balls picked in the first turn will be
n%3
On Saturday, 12 January 2013 18:33:45 UTC+5:30, siva wrote:
consider there are N balls in a basket. 2 players play the turns
alternatively ..AT each turn,the
@siva..
if (n%3 == 0)
Player 1 will lose
else
Player 1 will win. The no. of balls picked in the first turn will be
n%3
--
yes the below logic is correct
1- 1st(1)
2- 1st(2)
3- 2nd(1,2 or 2,1)
4- 1st (1,2,1 or 1,1,2)
5-1st(2, 1, 2 or 2, 2, 1)
6- 2nd(2, 1, 3) or 1, 2,3)) 2nd will win
7- 1st(1, 1, 2, 3 or 1, 2, 1,3 or .,.
8- 1st (2, 1, 2, 3 or 2, 2,1, 3 or ..
In above 3 can be (1,2) or (2,1)
Thanks
Kumar Anurag
On
@anurag : there is no need to SORT. as it will increase complexity O(n) to
O(n log n).
here is the correct code.. please look over it and notify me if i'm wrong .
T.C. = O( n )
// ex: 1 4 3 2 0 i'm explaining on behalf of it.
bool permute (int *arr , int N )
{
if ( N=1 ) return false;
Can anyone give me some idea if the given no is small like 12 then the next
one is 17
On Mon, Dec 24, 2012 at 7:56 PM, marti amritsa...@gmail.com wrote:
I REPEAT, THERE is no need to SORT;
http://en.wikipedia.org/wiki/Permutation#Lexicographical%5Forder%5Fgeneration
On Friday,
Hi Ritesh
Yeah, you are right. we do not need to sort. my bad
Thank you for explaining clearly
On Thu, Dec 27, 2012 at 4:29 AM, Ritesh Mishra rforr...@gmail.com wrote:
@anurag : there is no need to SORT. as it will increase complexity O(n) to
O(n log n).
here is the correct code.. please
I REPEAT, THERE is no need to SORT;
http://en.wikipedia.org/wiki/Permutation#Lexicographical%5Forder%5Fgeneration
On Friday, December 14, 2012 11:56:16 AM UTC+5:30, tapan rathi wrote:
For a given number, find the next greatest number which is just greater
than previous one and made up of
@marti
your answer is completely wrong (check for 234987156221 ans is 2349871*61225
* whereas your answer would be 2349871*65225*)
and we do need to sort
On Mon, Dec 17, 2012 at 9:10 AM, marti amritsa...@gmail.com wrote:
Yeah thanks Sandeep, theres an error in example...it should be
Here is what you do
EG: 5436782
ans is 5436872
how did we arrive?
FInd least index i, such that a[i-1] = a[i] starting from rigthmost
5436782
(8)
Now , Find least index j such that a[j-1] = a[i-1]:
5436782
(7)
swap them
= 5436872
Now swap all values between i and j.
hello all... anwer to previous example would be 5436827 instead of
5436872please correct it :)
On Sun, Dec 16, 2012 at 11:48 PM, marti amritsa...@gmail.com wrote:
Here is what you do
EG: 5436782
ans is 5436872
how did we arrive?
FInd least index i, such that a[i-1] = a[i] starting from
Let the number is stored in an array a[n] with MSB at index 0...
1. i = n-1;
reduce i till a[i]=a[i-1] i 0.
If here i =0 means give number is largest possible number made out of digits
otherwise i is pointing to a digit such that a[i]a[i+1]
2. find smallest digit from a[i+1 to n-1] just
Yeah thanks Sandeep, theres an error in example...it should be
5436827.However there is no need to sort.
On Friday, December 14, 2012 11:56:16 AM UTC+5:30, tapan rathi wrote:
For a given number, find the next greatest number which is just greater
than previous one and made up of same digits.
have a look http://amnwidfrenz-thinkalways.blogspot.in/2012/09/string-
reduction.html
--
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 this group, send email
@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',
On Friday, 17 August 2012 08:00:24 UTC+5:30, nick wrote:
Hi All,
Has anyone appeared for the online test of amazon recently??
if(yes){
Please share with us :)
}
On Friday, 17 August 2012 08:00:24 UTC+5:30, nick wrote:
Hi All,
Has anyone appeared for the
1. Given a linked list of letters arrange it in a way such that all vowels
come before the consonants and in the same order of input (i.e. order of
vowels should be same as they appear in input ).
ex- A-M-A-Z-O-N
o/p :- A-A-O-M-Z-N
2. Check parenthesis in a expression
1. A square
@yq, didn't I ask you this question before?
On Fri, Aug 10, 2012 at 4:48 PM, yq Zhang zhangyunq...@gmail.com wrote:
@shiv, your code is correct go compute the base 26 number. However, this
question is not base 26 number obviously.
On Wed, Aug 8, 2012 at 4:46 AM, shiv narayan
you can do it easily by counting the number that can be formed with 1 digit
= 26, then 2 digit = 26*26... similarly find the length of the answer and
then can find the number by searching using bsearch over the number of
different characters.
if someone can do it with base % method,, then it is
nope, doesnt work
even taking a simpler case like
a, b, aa, ab, ba, bb, aaa, aab, aba, abb...
using base 2 doesn't give correct results
On Mon, Aug 13, 2012 at 3:33 AM, vivek rungta vivekrungt...@gmail.comwrote:
its base 26 but little modification in code ...
@shiv - nice solution .
its base 26 but little modification in code ...
@shiv - nice solution .
char Carr[26]={a,b,c...z}
i=0;
int arr[];
do
{
arrr[i++]=n%26;
n=(n/26)-1;
}
while(n) ;
for(int i=n-1;i=0;i--)
coutCarr[a[i]];
On Sat, Aug 11, 2012 at 9:52 PM, yq Zhang zhangyunq...@gmail.com wrote:
No. It's not base 26
yes actually we have to print a,b,c..z instead of nos , so for that i have
stored nos in character array so only characters will be printed not nos
On Sat, Aug 11, 2012 at 2:18 AM, yq Zhang zhangyunq...@gmail.com wrote:
@shiv, your code is correct go compute the base 26 number. However, this
No. It's not base 26 at all. Given input 26, your code will return ba, but
the result should be aa. It's not equivalent to a number.
On Sat, Aug 11, 2012 at 2:57 AM, shiv narayan narayan.shiv...@gmail.comwrote:
yes actually we have to print a,b,c..z instead of nos , so for that i have
stored
@shiv, your code is correct go compute the base 26 number. However, this
question is not base 26 number obviously.
On Wed, Aug 8, 2012 at 4:46 AM, shiv narayan narayan.shiv...@gmail.comwrote:
this is similar to conversion of no in base 26.( where digits are
a,b,c,d...z) just think it like
this is similar to conversion of no in base 26.( where digits are
a,b,c,d...z) just think it like decimal to binary conversion here base is
instead 26.
char Carr[26]={a,b,c...z}
i=0;
int arr[];
do
{
arrr[i++]=n%26;
n/=2;
}
while(n) ;
for(int i=n-1;i=0;i--)
coutCarr[a[i]];
correct me if i am
in one special case of binary tree where each internal node has 2 children;
we can construct binary tree from these pre and postorder traversals.
On Wed, Aug 8, 2012 at 12:11 PM, Navin Kumar algorithm.i...@gmail.comwrote:
@shiv narayan: we are not going to create exact tree as original. You
Can u please explain the algorithm. is n't inorder always needed to
construct a unique tree?
On Sunday, July 15, 2012 1:41:15 AM UTC+5:30, Navin Kumar wrote:
Given Preorder and postorder traversals of a tree. Device an algorithm to
constuct a fully binary tree from these traversals.
--
You
Preorder and postorder do not uniquely define a binary tree.
so question is vague .
On Sunday, 15 July 2012 01:41:15 UTC+5:30, Navin Kumar wrote:
Given Preorder and postorder traversals of a tree. Device an algorithm to
constuct a fully binary tree from these traversals.
--
You received
Preorder and postorder do not uniquely define a binary tree.
so question is vague .
On Sunday, 15 July 2012 01:41:15 UTC+5:30, Navin Kumar wrote:
Given Preorder and postorder traversals of a tree. Device an algorithm to
constuct a fully binary tree from these traversals.
--
You received
@ankush,
I think the worst case time complexity will be [ (M+N) * L ]
this is beacuse, in the worst case all the 2-d arrays can probably contain
the element.
Now searching the single 2-D array needs O ( M+N )
But since there can be L such 2-D arrays in the worst case,
Wors case TC- O[ (M+N) *
Hi,
I think the following approach will work.
1. As the array is sorted in all three directions, assume the 3D array to
be a stack of rectangular arrays or 2D arrays.
Searching in a 2D array of size M*N is trivial - time complexity O(m +
n). Provided that the 2D array is sorted, both row
@ankush, there can be multiple probable 2D array according to your
definition.
On Wed, Jul 25, 2012 at 7:01 AM, ankush sharma anks...@gmail.com wrote:
Hi,
I think the following approach will work.
1. As the array is sorted in all three directions, assume the 3D array to
be a stack of
every element in 3D array can be written in the form of *(*(*(a+i)+j)+k) =
a[i][j][k]
ele = required element to be searched for
say M = number of 3D matrices
R = number of row
C = number of col
First find the most probable matrix in which the element might be present
fix j = R-1
fix k = C-1
this is interview street
post here freely
all the best
On Monday, 23 July 2012 19:40:12 UTC+5:30, rahul sharma wrote:
Guys i am having amazon support engg. test tonyt...90 min 27 questions
mcq...plz tell how to prepare and wats dis profyl???reply asap..and sory
for posting it in algogeeks
For the series like 2,4,3,9,4,16,5,25 ur algo runs in o(n*n/2) =o(n^2)
On Friday, 13 July 2012 13:16:50 UTC+5:30, jatin wrote:
1)Find product of the array and store it in say prod o(n) and o(1)
2)now traverse the array and check if
static int i;
tag:
while(in)
if( prod
If we can retrieve ith prime efficiently, we can do the following...
1.maintain a prod=1, start from 1st element, say a[0]=n find n th prime
2.check if (prod% (ith_prime * ith_prime )==0) then return i;
else prod=prod*ith_prime;
3.repeat it till end
On Thursday, 12 July 2012 10:55:02
.
Plus this will exceed O(n) in the worst case, as we may keep visiting
the goto again and again. Not sure of its exact time complexity.
--
From: vindhya chhabra
Sent: 13-07-2012 17:46
To: algogeeks@googlegroups.com
Subject: Re: [algogeeks] Re: Amazon Interview
Or we can make a BST from array list in o(n)
then traverse it inorder-o(logn)
but this solution requires o(logn) space though.
On Friday, 13 July 2012 13:16:50 UTC+5:30, jatin sethi wrote:
1)Find product of the array and store it in say prod o(n) and o(1)
2)now traverse the
@jatin:
Your first method may be proved wrong.
Here is a counter test case:
Suppose the array is:
27 729 19683 2 3 3 27 3 81 729
Here, 81 occurs once, 19683 occurs once, 2 occurs once,729 occurs twice, 27
occurs twice, and 3 occurs thrice.
You are supposed to return 3
But as per your method,
@adarsh
But i think jatin has asked to check for the number( we achieved in step 1)
occuring thrice or not..and in this check 27 will rule out.but i doubt the
algo given by Jatin runs in O(n) time. please comment.
On Fri, Jul 13, 2012 at 5:17 PM, adarsh kumar algog...@gmail.com wrote:
@jatin:
To: algogeeks@googlegroups.com
Subject: Re: [algogeeks] Re: Amazon Interview Question
@adarsh
But i think jatin has asked to check for the number( we achieved in step 1)
occuring thrice or not..and in this check 27 will rule out.but i doubt the
algo given by Jatin runs in O(n) time. please comment.
On Fri
@googlegroups.com
Subject: Re: [algogeeks] Re: Amazon Interview Question
@adarsh
But i think jatin has asked to check for the number( we achieved in step
1) occuring thrice or not..and in this check 27 will rule out.but i doubt
the algo given by Jatin runs in O(n) time. please comment.
On Fri
exact time complexity.
--
From: vindhya chhabra
Sent: 13-07-2012 17:46
To: algogeeks@googlegroups.com
Subject: Re: [algogeeks] Re: Amazon Interview Question
@adarsh
But i think jatin has asked to check for the number( we achieved in step
1) occuring thrice
chhabra
Sent: 13-07-2012 17:46
To: algogeeks@googlegroups.com
Subject: Re: [algogeeks] Re: Amazon Interview Question
@adarsh
But i think jatin has asked to check for the number( we achieved in step
1) occuring thrice or not..and in this check 27 will rule out.but i doubt
the algo given by Jatin
: 13-07-2012 17:46
To: algogeeks@googlegroups.com
Subject: Re: [algogeeks] Re: Amazon Interview Question
@adarsh
But i think jatin has asked to check for the number( we achieved in step
1) occuring thrice or not..and in this check 27 will rule out.but i doubt
the algo given by Jatin runs in O
+1.
--
From: Shruti Gupta
Sent: 14-07-2012 08:08
To: algogeeks@googlegroups.com
Subject: Re: [algogeeks] Re: Amazon Interview Question
@jatin: even i think it will b more than O(n).. infact it will be
O(n-square) in the worst case as if each hit is spurious(until
@Algo bard: No. You can do an O(n) time, O(n) space solution with a radix
sort, or you can do an O(n log n) time, O(1) space solution with a variety
of sorts.
Dave
On Thursday, July 12, 2012 12:25:02 AM UTC-5, algo bard wrote:
Given an array of integers where some numbers repeat once, some
If the assumption is that there is only one element which occurs
once , some elements repeat twice and only one element which repeats
thrice
then following is the code according to the assumption made
http://ideone.com/yseYy
--
You received this message because you are subscribed to the
just have a look on segment tree ( u can found good study material on
segment tree at topcoder algorithm tutorial)
On Monday, 25 June 2012 18:13:50 UTC+5:30, Navin Kumar wrote:
please provide some good data structure to solve this problem:
http://www.careercup.com/question?id=14062676
could u explain how would you use a trie for this??
On Thursday, June 14, 2012 1:01:00 PM UTC+5:30, Mohit Rathi wrote:
Hi,
*There are two arrays of length 100 each. Each of these has initially n
(n=100)
elements. First array contains names and the second array contains numbers
such that
Store each of the words in array in a trie and mark the end of the word by
its corresponding entry in the second array. Now if u are searching for a
word it'll take O(length of word) if there is a mismatch at any point you
know the word is not present in array1 and add it to the trie or else
You can use a trie with end of word marked by its corresponding entry in
array.
On Thursday, 14 June 2012 13:01:00 UTC+5:30, Mohit Rathi wrote:
Hi,
*There are two arrays of length 100 each. Each of these has initially n
(n=100)
elements. First array contains names and the second array
+1 for trie..
--
Amol Sharma
Third Year Student
Computer Science and Engineering
MNNIT Allahabad
http://gplus.to/amolsharma99
http://twitter.com/amolsharma99http://in.linkedin.com/pub/amol-sharma/21/79b/507http://www.simplyamol.blogspot.com/
On Fri, Jun 15, 2012 at 5:21 PM, enchantress
Hassan geke should not be a valid string. The question states which have
the same substring following it so here e follows e. There is no
precondition that it has to follow immediate.
Utsav: can you clarify?
Best Regards
Ashish Goel
Think positive and find fuel in failure
+919985813081
nope geke is valid string..
here is the link from where question was taken
http://geeksforgeeks.org/forum/topic/amazon-interview-question-password-checker
On Wed, Jun 6, 2012 at 11:44 AM, Ashish Goel ashg...@gmail.com wrote:
Hassan geke should not be a valid string. The question states which
geke is valid. BTW if you changeif(i=len) toif(i0) my code
outputs geke is invalid.( what you desired)
if geke is invalid regarding to the question, then you can achieve the
answer in nLogn by sorting strings :s[0..n-1], s[1..n-1],s[n-1..n-1]
and comparing adjacent members.
Regards
@ashish:- geke is valid as repeated substrings should be immediate.
On Wed, Jun 6, 2012 at 1:44 PM, Hassan Monfared hmonfa...@gmail.com wrote:
geke is valid. BTW if you changeif(i=len) toif(i0) my code
outputs geke is invalid.( what you desired)
if geke is invalid regarding to the
1 - 100 of 818 matches
Mail list logo