Re: [algogeeks] Re: Google Interview Question: In how many intervals does a number exists

2013-06-11 Thread Avi Dullu
Can you tell the 'size' of your array 'f' if the intervals are [0, 10], [10, 9223372036854775808] ? Programmers should realize their critical importance and responsibility in a world gone digital. They are in many ways similar to the priests and monks of Europe's Dark Ages; they are the only ones

Re: [algogeeks] Re: Google Interview Question

2011-08-01 Thread Douglas Diniz
This is a simple merge, so what is the trick? Did you forget something? On Mon, Aug 1, 2011 at 3:19 PM, Gary Drocella gdroc...@gmail.com wrote: Here is O(n) alg... Does Waste Memory Though :) just don't have an array over 4G, and you should be good. proc Merge_Partition(A) B = {}; index =

Re: [algogeeks] Re: Google Interview Question

2011-08-01 Thread Samba Ganapavarapu
@Diniz I guess they asked to do in inplace ( with no extra array ) On Mon, Aug 1, 2011 at 2:41 PM, Douglas Diniz dgdi...@gmail.com wrote: This is a simple merge, so what is the trick? Did you forget something? On Mon, Aug 1, 2011 at 3:19 PM, Gary Drocella gdroc...@gmail.com wrote: Here is

Re: [algogeeks] Re: Google interview question

2011-07-18 Thread surender sanke
@Dave awesome..! On Sat, Jul 16, 2011 at 7:15 PM, Dave dave_and_da...@juno.com wrote: @Anand: Assuming that the file contains unsigned 32-bit integers. Set an integer array a[65536] to zero, read through the file and tally the numbers based on their low-order 16 bits: a[j0x]++. Since 4.3

Re: [algogeeks] Re: Google Interview Question

2011-06-05 Thread Wladimir Tavares
A B are the concatenation of A and B. Set the following order relation between the numeric strings A = B iff A B = B A Wladimir Araujo Tavares *Federal University of Ceará * On Sat, May 28, 2011 at 1:54 PM, sunny agrawal sunny816.i...@gmail.comwrote: @Logic King No, My algo will take

Re: [algogeeks] Re: Google Interview Question

2011-05-29 Thread sravanreddy001
@vishal,Sanjeev.. for the inputs 18,187.. apply ur method.. 18 -- 188 187-- 187 18187 - ur method 18718 - actual @Sunny... i agree that your algorithm takes the *O(N logN)* time.. but again.. the problem is it* doesn't get* the exact solution. Do we really have a polynomial solution for this

Re: [algogeeks] Re: Google Interview Question

2011-05-29 Thread sunny agrawal
@sravanreddy001 i don't find any cases for which my algo fails and its O(nlgn) i may be missing something can you tell any case where it fails On Sun, May 29, 2011 at 10:15 PM, sravanreddy001 sravanreddy...@gmail.comwrote: @vishal,Sanjeev.. for the inputs 18,187.. apply ur method.. 18 --

Re: [algogeeks] Re: Google Interview Question

2011-05-28 Thread sanjeev chakravarty
Here is a Java impl... public class LargestPossibleNumber { static class LPNComparator implements ComparatorString { @Override public int compare(String s1, String s2) { int l1 = s1.length(); // new element int l2 = s2.length(); // existing element if (l1 == l2) { for (int i1 = 0, i2 = 0; i1

Re: [algogeeks] Re: Google Interview Question

2011-05-28 Thread sunny agrawal
@Logic King No, My algo will take only O(nlgn) where n is no of elements. what i mean by editing the comparision function cmp function of sort of algorithm.h sort(a,a+n, cmp); where cmp is the comparision function defined in my prev. post it will take equal no. of comparision as in sorting.

Re: [algogeeks] Re: Google Interview Question

2011-05-27 Thread Logic King
@sunny it will work fine if you have 2 numbers only...but what about the list...3..4 or 5..or morethen the possible number of combinations will be 'N!'...where n is the number of digits...the code will work quite slowly for larger 'n'. On Fri, May 27, 2011 at 3:33 PM, Dave

Re: [algogeeks] Re: GOOGLE INTERVIEW QUESTION

2011-05-10 Thread Anders Ma
take “aabab” for example, the result is aba, b,a; however, the right result is aa,bab On Wed, May 11, 2011 at 10:57 AM, shubham shubh2...@gmail.com wrote: check this one out: #includeiostream #includecstdio #includevector #includecstring using namespace std; int check_palin(string

Re: [algogeeks] Re: Google Interview Question

2011-01-08 Thread LALIT SHARMA
@bittu I would like to discuss one thing regarding your approach , How you managed to put forward your 1st statement that is of Synchronization . On Fri, Jan 7, 2011 at 1:18 PM, Pedro Rezende web...@gmail.com wrote: Hi all! And what could be the best way to test / debug issues like these?

Re: [algogeeks] Re: Google Interview Question

2011-01-07 Thread vaibhav agrawal
@Douglas, nicely put!!! On Fri, Jan 7, 2011 at 8:37 PM, Douglas Diniz dgdi...@gmail.com wrote: Some examples, supposing you do always the same thing: 1-) You have a program that use some random number, and based on the number the program do different things, and this different things crash

Re: [algogeeks] Re: Google Interview Question

2011-01-07 Thread Pedro Rezende
Hi all! And what could be the best way to test / debug issues like these? 2011/1/7 vaibhav agrawal agrvaib...@gmail.com @Douglas, nicely put!!! On Fri, Jan 7, 2011 at 8:37 PM, Douglas Diniz dgdi...@gmail.com wrote: Some examples, supposing you do always the same thing: 1-) You have a

Re: [algogeeks] Re: Google Interview Question

2010-12-28 Thread Terence
The description on internal nodes indicates this: The value of an AND gate node is given by the logical AND of its TWO children's values. The value of an OR gate likewise is given by the logical OR of its TWO children's values. On 2010-12-28 13:35, suhash wrote: Your approach is for a

Re: [algogeeks] Re: Google Interview Question

2010-12-28 Thread Terence
Let cst[i][j] store the cost to flip node i to given gate j (0-'AND', 1-'OR'). Then: cst[i][j] = 0,if j==gate[i]; cst[i][j] = 1,if j!=gate[i] and ok[i]; cst[i][j] = INFINITY, if j!=gate[i] and !ok[i]; 1. To get value 1: 1.1 flip current gate to AND, and change all

Re: [algogeeks] Re: Google Interview Question

2010-09-18 Thread pratik kathalkar
On Fri, Sep 17, 2010 at 3:36 PM, Krunal Modi krunalam...@gmail.com wrote: Your solutions are pretty impressive. Which place(country) are you from ? where are you studying (or done :) ) ? Keep it up... Good Wishes.. --Krunal On Sep 14, 9:29 pm, Gene gene.ress...@gmail.com wrote: You can

Re: [algogeeks] Re: Google Interview Question-Snake and Ladder Design

2010-09-17 Thread Anil Kumar S. R.
@bittu, we are here to discuss the way to solve it. Posting a code here will not do anything good. Anil Kumar S. R. http://sranil.googlepages.com/ The best way to succeed in this world is to act on the advice you give to others. On 14 September 2010 13:33, bittu shashank7andr...@gmail.com

Re: [algogeeks] Re: Google Interview Question-Snake and Ladder Design

2010-09-14 Thread siddharth srivastava
Hi On 14 September 2010 13:33, bittu shashank7andr...@gmail.com wrote: #includestdlib.h #includestdio.h #includemath.h #includeconio.h ///O(N^2) solution Does solution exits in O(n) or (nlogn)..? reply me sum1 git dis.. //i will post analysis of dsi

Re: [algogeeks] Re: Google Interview Question

2010-08-22 Thread ashish agarwal
but addition also should be in array On Sun, Aug 22, 2010 at 3:05 AM, arpit agarwal erarpitagar...@gmail.comwrote: Just find out the max and 2nd max in n + log(n) -2 steps and add them. there is no need for sorting as such -- You received this message because you are subscribed to the