Re: [algogeeks] Re: SPOJ problem code:MAJOR

2011-02-14 Thread sunny agrawal
try replacing cin, cout by printf,scanf On Mon, Feb 14, 2011 at 5:39 PM, Akshata Sharma akshatasharm...@gmail.comwrote: link to problem: http://www.spoj.pl/problems/MAJOR/ On Feb 14, 5:03 pm, Akshata Sharma akshatasharm...@gmail.com wrote: I am trying to submit my solution but its giving

Re: [algogeeks] no. of passwords

2011-02-09 Thread sunny agrawal
is it 26C3 * 26C3 * 10C2 * 62C2 * 10! On Wed, Feb 9, 2011 at 7:16 PM, snehal jain learner@gmail.com wrote: how many passwords can be made if 1. there should be atleast 3 capital letters 2. atleast 3 small letters 3. atleast 2 numbers 0-9 4 the password should has length=10 -- You

Re: [algogeeks] no. of passwords

2011-02-09 Thread sunny agrawal
...@gmail.comwrote: Are all the selected letters or numbers always different? If they can also be same then answer would be different. On Wed, Feb 9, 2011 at 7:20 PM, sunny agrawal sunny816.i...@gmail.comwrote: is it 26C3 * 26C3 * 10C2 * 62C2 * 10! On Wed, Feb 9, 2011 at 7:16 PM, snehal jain

Re: [algogeeks] no. of passwords

2011-02-09 Thread sunny agrawal
.. On Wed, Feb 9, 2011 at 10:33 PM, sunny agrawal sunny816.i...@gmail.comwrote: yes they can be same, forgot to consider that so it should be (26^3)*(26^3)*(10^2)*(62^2)*(10!) ?? On Wed, Feb 9, 2011 at 10:20 PM, snehal jain learner@gmail.comwrote: letters and no. can be same... so the ans

Re: [algogeeks] CODECHEF FLIP COIN problem

2011-02-08 Thread sunny agrawal
. Any idea what time complexity will suffice ? Could you please elaborate your reply . On Tue, Feb 8, 2011 at 1:08 PM, sunny agrawal sunny816.i...@gmail.comwrote: i think your solution will be O(n) for each query so it will be O(Q*N), that will surely timeout read about Range Trees, segment

Re: [algogeeks] CODECHEF FLIP COIN problem

2011-02-08 Thread sunny agrawal
out any good way of doing this . [?][?] Could you please suggest me something or give some idea . Thanks for helping On Tue, Feb 8, 2011 at 1:51 PM, sunny agrawal sunny816.i...@gmail.comwrote: i think time complexity of the O(nlgn) for an avg case will suffice no it will not be inefficient

Re: [algogeeks] Puzzle Will Stuck

2011-02-08 Thread sunny agrawal
finally all square number gates will be open On Wed, Feb 9, 2011 at 2:10 AM, bittu shashank7andr...@gmail.com wrote: There are N doors in a row numbered from 1 to N. Initially all are closed. Then you make N passes by the N doors. In pass 1 you toggle the all the doors (1,2,3,4)starting

Re: [algogeeks] array(amazon microsoft)

2011-02-07 Thread sunny agrawal
one of the possible methods is to use concept same as EXTRACT-MIN of heaps do the following steps *m*n *times 1. print a[0][0] ans replace this by a[m-1][n-1] 2. call REORDER(0,0) in REORDER(i,j) function we perform following operations to make array's all row's and column's sorted 1.if a[i,j] =

Re: [algogeeks] CODECHEF FLIP COIN problem

2011-02-07 Thread sunny agrawal
i think your solution will be O(n) for each query so it will be O(Q*N), that will surely timeout read about Range Trees, segment trees from wiki or CLRS On Tue, Feb 8, 2011 at 1:01 PM, Gaurav Saxena grvsaxena...@gmail.comwrote: I need help regarding the codechef flip coin problem . I am trying

Re: [algogeeks] Re: codechef problem

2011-02-02 Thread sunny agrawal
@Dave O(n^2lgn) will exceed given time limit question contains some constraints, that should be used to overcome time limit in general your algorithm is good enough i think !! On Wed, Feb 2, 2011 at 8:21 PM, Dave dave_and_da...@juno.com wrote: @TR: See my algorithm at

Re: [algogeeks] Re: codechef problem

2011-02-02 Thread sunny agrawal
http://www.codechef.com/FEB11/ On Thu, Feb 3, 2011 at 12:54 AM, Dave dave_and_da...@juno.com wrote: What contest? On Feb 2, 12:41 pm, radha krishnan radhakrishnance...@gmail.com wrote: I wonder U people discuss the solution during the contest ? On Wed, Feb 2, 2011 at 11:59 PM,

Re: [algogeeks] Re: Amazon Written Tes Q1

2011-01-30 Thread sunny agrawal
if we can do it for DLL using Comparison sort, then why not for array make an DLL of elements of array, sort in DLL and put back in array. not possible using Comparison sort. i think interviewer asked this question to see your reasoning, how you handle these type of question ? -- You received

Re: [algogeeks] Re: Puzzle

2011-01-27 Thread sunny agrawal
another one 9*(1+ 1/9) On Thu, Jan 27, 2011 at 5:40 PM, nhkrishna2...@yahoo.com nhkrishna2...@gmail.com wrote: 9+1+1/9 On Jan 27, 4:43 pm, ankit agarwal ankitgeniu...@gmail.com wrote: (9*9-1)/(9-1) On Thu, Jan 27, 2011 at 4:55 PM, nishaanth nishaant...@gmail.com wrote:

Re: [algogeeks] 2 d matrix

2011-01-25 Thread sunny agrawal
@snehal can elements can be in any order?? i mean if ith row contains {1,2,3,4} and jth column contains {4,3, 2,1} it will be a match or not On Tue, Jan 25, 2011 at 7:02 PM, snehal jain learner@gmail.com wrote: you have a matrix containing integers (no range provided). The matrix is

Re: [algogeeks] Re: MBINGO

2011-01-24 Thread sunny agrawal
@rgap i think u have misunderstood the question u are solving for old version of game it says solve for new version specified in 2nd paragraph but not a big problem, can be done with slight modifications as input is small, just generate all B^2 possibilities and keep track of absolute differences

Re: [algogeeks] Re: Hellof Friends. Regarding Microsoft Internship test

2011-01-18 Thread sunny agrawal
from last 2 years they haven't asked questions on OS in written. it depends if written contains objective type questions also, OS may also be there -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

Re: [algogeeks] Re: Hellof Friends. Regarding Microsoft Internship test

2011-01-18 Thread sunny agrawal
from last 2 years i mean from last 2 years @IIT Roorkee On Tue, Jan 18, 2011 at 6:12 PM, sunny agrawal sunny816.i...@gmail.comwrote: from last 2 years they haven't asked questions on OS in written. it depends if written contains objective type questions also, OS may also

Re: [algogeeks] Re: Bit Manipulation

2011-01-17 Thread sunny agrawal
Q1: initially compute xor of all the values from 0 to n in a variable Temp so temp = 0^1^2^n let result is used to store the missing number for each ith bit of missing number where i = 0-31 we can find it as following ith bit of result = (xor of all ith bits of values of array) xored with

Re: [algogeeks] Re: Hellof Friends. Regarding Microsoft Internship test

2011-01-16 Thread sunny agrawal
format of written test MS currently following for interns based on my experience Q1: given a code, write o/p Q2: finding bugs in a program / code a MS standard question Q3: code MS standard question Q4: writing test cases for give problem Q5: Product Designing related and in interviews mostly

Re: [algogeeks] Re: MICROSOFT IDC

2011-01-12 Thread sunny agrawal
@manoj we need to find a common node, not nodes in list having same values how a node can be pointing to 2 next values at the same time as in your case 3 is pointing to both null and 6, I think On Wed, Jan 12, 2011 at 5:44 PM, manoj manoj.lala...@gmail.com wrote: my understanding of question

Re: [algogeeks] scales - binary search spoj

2011-01-12 Thread sunny agrawal
searching the immediately largest can fail i think but depends how u handeled as in case of 11 , immediately larger is 27 but it can be handled using 1,3,9 only as 9+3-1 so what is needed is find min i such that for 0-i sum of 3^i's is greater than X On Wed, Jan 12, 2011 at 11:42 PM, muthu

Re: [algogeeks] Amazon Question

2011-01-11 Thread sunny agrawal
2nd array contains elements upto first Y positions ?? On Tue, Jan 11, 2011 at 6:59 PM, bittu shashank7andr...@gmail.com wrote: 1.Given two Sorted Array 1ts is size of X and 2nd is size of X+Y we have to merge 1st into 2nd array ..No Additional Memory ,Data Structure Allowed to Use...Write a

Re: [algogeeks] Re: Amazon Question

2011-01-11 Thread sunny agrawal
best method i know is. start comparing elements from ends and put the larger at end and so on TC: O(X+Y) SC: O(1) On Tue, Jan 11, 2011 at 8:11 PM, bittu shashank7andr...@gmail.com wrote: @juver++ so post your approach...i will also do the same..i posted the question here so that we can

Re: [algogeeks] program for evaluation of remainders

2010-12-08 Thread sunny agrawal
@Ashim with a check that N =n N can also be less than n On Wed, Dec 8, 2010 at 6:57 PM, Ashim Kapoor ashimkap...@gmail.com wrote: Let me try. Any thing involving n would leave no remainder. so (1 + 2 ! + ... + n ! + + N !) mod n = (1 + 2 ! + ... + (n-1)! ) mod n This should be

Re: [algogeeks] Brain Teaser

2010-11-11 Thread sunny agrawal
@rohit 4 5 are diagonally adjacent . On Thu, Nov 11, 2010 at 5:09 PM, Rohit Singhal rsinghal.it...@gmail.comwrote: 1 5 2 6 - - - - - - 3 7 4 8 On Thu, Nov 11, 2010 at 3:16 PM, Abhilasha jain mail2abhila...@gmail.comwrote: solution is 5 1 6 2 _ _ _ _ 7 3 8 4 On Thu, Nov

Re: [algogeeks] longest interval

2010-11-01 Thread sunny agrawal
@sumanth can you plz post algorithm in short. On Mon, Nov 1, 2010 at 3:45 PM, sumant hegde sumant@gmail.com wrote: see attached file On Sun, Oct 31, 2010 at 4:27 PM, snehal jain learner@gmail.comwrote: Find longest interval:- We are given with two arrays A and B..each of size

<    1   2   3   4