[algogeeks] Facebook phone interview questions

2012-10-05 Thread ~*~VICKY~*~
Hi guys pls share the quest you know that was asked in facebook phone interview. Thank you. -- Cheers, Vicky -- 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

Re: [algogeeks] Facebook question!

2012-10-03 Thread Sudhir
A solution in java without arrays... class Combinations { static ArrayList words = new ArrayList(); static void getCombinations(ArrayList words) { for(int j=0;j No we don't need to care about repeated strings. :) Thanks for the > response folks. > > On Mon, Oct 1, 2012 at 8:42 PM, saurabh ag

Re: [algogeeks] Facebook question!

2012-10-01 Thread saurabh agrawal
Do we need to handle cases when the same string will appear again?? In that case we can sort individual array and remove duplicates. On Mon, Oct 1, 2012 at 9:54 AM, Rahul Singh wrote: > check this out.. > > #include > #include > using namespace std; > > void print_sets(string *s,int pos,int n,ch

Re: [algogeeks] Facebook question!

2012-10-01 Thread Rahul Singh
check this out.. #include #include using namespace std; void print_sets(string *s,int pos,int n,char *to_print) { if(pos==n) { return; } for(int i=0;i>n; string s[n]; for(int i=0;i>s[i]; } char *to_print = new char[n]; print_sets(s,0,n,to_print); } --

Re: [algogeeks] Facebook question!

2012-10-01 Thread Rahul Singh
check this out.. #include #include using namespace std; void print_sets(string *s,int pos,int n,char *to_print) { if(pos==n) { return; } for(int i=0;i>n; string s[n]; for(int i=0;i>s[i]; } char *to_print = new char[n]; print_sets(s,0,n,to_print); }

Re: [algogeeks] Facebook question!

2012-09-30 Thread atul anand
your debugged code :- error you were making was in tacking the row at each recursive call...and outer loop runs for 2...which should actually runs for all words #include #include #include using namespace std; string str[]={"hello", "how","a"}; #define words_len 3 void print_all(string sel, int row

Re: [algogeeks] Facebook question!

2012-09-30 Thread atul anand
my prev code was incorrect :- here is the correct code :- void combination(char str[3][100],int len,int row,int j) { static char prn[3]; int i=0,k=0,p=0; if(j==2) { prn[j]='\0'; printf("\n%s",prn); return; } for(p=ro

Re: [algogeeks] Facebook question!

2012-09-30 Thread atul anand
void combination(char str[2][100],int len,int row,int j) { static char prn[3]; int i=0,k=0,p=0; if(j==2) { prn[j]='\0'; printf("\n%s",prn); } for(p=row;p wrote: > Given 'n' arrays each of variable sizes. Write code to print all >

[algogeeks] Facebook Interview Question

2012-07-30 Thread Mahendra Sengar
There are K pegs. Each peg can hold discs in decreasing order of radius when looked from bottom to top of the peg. There are N discs which have radius 1 to N; Given the initial configuration of the pegs and the final configuration of the pegs, output the moves required to transform from the i

[algogeeks] Facebook Interview Question

2012-07-30 Thread sengar.mahi
There are K pegs. Each peg can hold discs in decreasing order of radius when looked from bottom to top of the peg. There are N discs which have radius 1 to N; Given the initial configuration of the pegs and the final configuration of the pegs, output the moves required to transform from the initial

Re: [algogeeks] Facebook qsrtn

2012-05-02 Thread Bhaskar Guthikonda
You need to have idea about algorithm design techniques such as Greedy method and Dynamic Programming for these kind of problems. (1) Greedy method always selects local optima to achieve global optima. This is very intuitive method and simple to implement, but doesn't always yield optimal solution

[algogeeks] Facebook qsrtn

2012-05-01 Thread Ravi Ranjan
We have been given a deck of cards and each combination has a rating eg 3 As is higher than 2 As 1K etc. Write an algorithm such that the probability of picking 3 or 5 or 7 cards from the deck results in high rating plzzz tell how to approach these kind of problems??? -- You received this messa

Re: [algogeeks] Facebook interview question.

2012-01-09 Thread atul anand
@Piyush : yes it works ... please check the link again ..Lucifer has added more details to the same post for better explanation. follow that link and if you have any queries post your queries on that old link. On Mon, Jan 9, 2012 at 1:04 PM, Piyush Grover wrote: > Hi Atul > > Yes, I posted it ear

Re: [algogeeks] Facebook interview question.

2012-01-09 Thread Siddhartha Banerjee
does this work if array elements are negative??? -- 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 to algogeeks+unsubscr...@googlegroup

Re: [algogeeks] Facebook interview question.

2012-01-08 Thread Piyush Grover
Hi Atul Yes, I posted it earlier but couldn't keep track of it, thanks for the link. I still have a doubt, does it give all the maximal subsets or all the subsets. I couldn't get it from the algo posted by Lucifer. On Mon, Jan 9, 2012 at 9:45 AM, atul anand wrote: > @Piyush : > you are re-posti

Re: [algogeeks] Facebook interview question.

2012-01-08 Thread atul anand
@Piyush : you are re-posting same problem which you had posted on 5 dec 2011. check this link :- http://groups.google.com/group/algogeeks/browse_thread/thread/8a58ea05c96f811b/ee74f8a4d7b68561?lnk=gst&q=Maximal+possible+subsets+Algorithm#ee74f8a4d7b68561 On Mon, Jan 9, 2012 at 3:27 AM, Piyush G

[algogeeks] Facebook interview question.

2012-01-08 Thread Piyush Grover
Given a set S, find all the maximal subsets whose sum <= k. For example, if S = {1, 2, 3, 4, 5} and k = 7 Output is: {1, 2, 3} {1, 2, 4} {1, 5} {2, 5} {3, 4} Hint: - Output doesn't contain any set which is a subset of other. - If X = {1, 2, 3} is one of the solution then all the subsets of X {1} {

Re: [algogeeks] Facebook Question

2011-12-22 Thread SAMM
@UTKARSH SRIVASTAV Give the implemetation logic instead of the name of the DS . -- 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 to a

Re: [algogeeks] Facebook Question

2011-12-21 Thread UTKARSH SRIVASTAV
use k-d tree On Thu, Dec 22, 2011 at 9:25 AM, atul anand wrote: > to find all points which lies on the same quadrant for a specific node(say > 1) , we have to check all nodes...rite?? > we have to find difference b/w 2 node(frome origin ) is less or greater > than distance b/w 2 nodes...rite?? >

Re: [algogeeks] Facebook Question

2011-12-21 Thread atul anand
to find all points which lies on the same quadrant for a specific node(say 1) , we have to check all nodes...rite?? we have to find difference b/w 2 node(frome origin ) is less or greater than distance b/w 2 nodes...rite?? so if i am not getting it wrong it wil be O(n^2) anyhow. On Thu, Dec 22, 2

Re: [algogeeks] Facebook Question

2011-12-21 Thread Algoose chase
Yup, it could be O(n^2) in the worst case. On Wed, Dec 21, 2011 at 1:59 PM, Carol Smith wrote: > @Algoose, in worst case, this is still O(n^2), ain't it? > > On Wed, Dec 21, 2011 at 12:50 PM, Algoose chase wrote: > >> Find the distance between each of the points and the origin(0,0) and sort >> th

Re: [algogeeks] Facebook Question

2011-12-21 Thread rahul
@harish What if all the points are in the same quadrant and and are equidistant from 0,0. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/NjysUthIqgYJ. To

Re: [algogeeks] Facebook Question

2011-12-21 Thread Carol Smith
@Algoose, in worst case, this is still O(n^2), ain't it? On Wed, Dec 21, 2011 at 12:50 PM, Algoose chase wrote: > Find the distance between each of the points and the origin(0,0) and sort > the points based on this distance. > Also, divide the points based on which quadrant they belong. If the >

Re: [algogeeks] Facebook Question

2011-12-21 Thread Algoose chase
Find the distance between each of the points and the origin(0,0) and sort the points based on this distance. Also, divide the points based on which quadrant they belong. If the difference between their distance(from origin) between 2 points is less and they belong to the same quadrant, then they a

[algogeeks] Facebook Question

2011-12-20 Thread SAMMM
You are given a list of points in the plane, write a program that outputs each point along with the three other points that are closest to it. These three points ordered by distance. The order is less then O(n^2) . For example, given a set of points where each line is of the form: ID x-coordinate

Re: [algogeeks] facebook interview question

2011-12-04 Thread Deepak Nettem
Greetings! The strategy should be to process the elements in pairs - and compare the larger element with current maximum, and smaller element with current minimum. loop runs upto n in steps of 2, and in each iteration, there are 3 comparisons: - between (i)th and (i+1)th element - between min(i,

Re: [algogeeks] facebook interview question

2011-12-04 Thread Anika Jain
refer algorithms by cormen for this On Mon, Nov 28, 2011 at 9:56 PM, Nitin Garg wrote: > Find the min and max in an array. Now do it in less than 2n comparisons. > (they were looking for the solution that finds both max and min in about > 3/2 n comparisons). > > > -- > Nitin Garg > > "Personality

Re: [algogeeks] facebook interview question

2011-11-28 Thread Aamir Khan
Take numbers in pair of 2, compare with each other and then compare the maximum among them with max (maximum element so far) and minimum among them with min (minimum element so far) , In this way you will be able to find max, min in 3 comparisons for each 2 integers. Hence 3n/2 comparisons needed f

[algogeeks] facebook interview question

2011-11-28 Thread Nitin Garg
Find the min and max in an array. Now do it in less than 2n comparisons. (they were looking for the solution that finds both max and min in about 3/2 n comparisons). -- Nitin Garg "Personality can open doors, but only Character can keep them open" -- You received this message because you are

Re: [algogeeks] Facebook Online Question India

2011-11-10 Thread Ashish Goel
build a multimap and a map multimap to contain occurances of words of pattern substring in bigger substring and map is to keep track of words covered in second parse the pattern substring is say "abc def geh ijk" and the given string is "abc ijk lmn geh ijk def def abc lmn" the multimap will

Re: [algogeeks] Facebook Online Question India

2011-11-10 Thread Ashish Goel
KMP is exact substring match, so this is tricky.. Best Regards Ashish Goel "Think positive and find fuel in failure" +919985813081 +919966006652 On Thu, Nov 10, 2011 at 6:05 PM, Amol Sharma wrote: > this can be done by simple string matching...KMP algo. > correct me if i am wrong !! > -- >

Re: [algogeeks] Facebook Online Question India

2011-11-10 Thread Jagannath Prasad Das
How many students they took and whats the offer? On Thu, Nov 10, 2011 at 8:03 AM, rahul sharma wrote: > facebook visit DCE???wats package??? > > > On Wed, Nov 9, 2011 at 9:22 PM, Decipher wrote: > >> This question was asked by Facebook during their 2 hour online exam (Only >> 1 question in 2 hou

Re: [algogeeks] Facebook Online Question India

2011-11-10 Thread Amol Sharma
this can be done by simple string matching...KMP algo. correct me if i am wrong !! -- Amol Sharma Third Year Student Computer Science and Engineering MNNIT Allahabad

Re: [algogeeks] Facebook Online Question India

2011-11-09 Thread rahul sharma
facebook visit DCE???wats package??? On Wed, Nov 9, 2011 at 9:22 PM, Decipher wrote: > This question was asked by Facebook during their 2 hour online exam (Only > 1 question in 2 hour as per my junior) in DCE. > > Given a list of words wordlist on 1st line (no of words <= 100) and a > string qst

[algogeeks] Facebook Online Question India

2011-11-09 Thread Decipher
This question was asked by Facebook during their 2 hour online exam (Only 1 question in 2 hour as per my junior) in DCE. Given a list of words wordlist on 1st line (no of words <= 100) and a string qstr of len <= 1 million on 2nd line, print the index at qstr where a continuous substring exists

[algogeeks] FACEBOOK ONLINE CODING ROUND

2011-10-27 Thread icy`
small typo.. in part 2) it should say 13-(1+4+6)=2. Basically when the position becomes smaller than the element, you stop subtracting. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@

Re: [algogeeks] FACEBOOK ONLINE CODING ROUND

2011-10-21 Thread sunny agrawal
yea i know 1st Approach is much better and is Only O(N^2) for precomputing all the values for nck and then O(k) for finding no of bits set in The Kth number and another loop of O(k) to find the required number i posted 2nd approach in the context to vandana's tree approach of sorting 2^N numbers,

Re: [algogeeks] FACEBOOK ONLINE CODING ROUND

2011-10-21 Thread sravanreddy001
@Sunny.. why do we need an O(2^N) complexity? for a value of N=40-50, the solution is not useful.. but, your 1st approach is lot better and i have got it too.. 1. O(N) complexity to search the k. (k bits in the numbers) x- (sigma 1->k (n C i)) 2. again, keep substracting (k-i) for i= 0->k-1

Re: [algogeeks] FACEBOOK ONLINE CODING ROUND

2011-10-19 Thread sunny agrawal
yes u r wrong 11 11<<1 = 110 but sequence will be 11 101 110 On Thu, Oct 20, 2011 at 12:18 AM, tin wrote: > Can you just generate them sorted? > > 1 is the minimum > 1 << 1 is the next in line > 1 << 2 is the next one > > 1 << N > 11 > 11 << 1 > > and so on > > Am i wrong? > > Il 19/10/2011

Re: [algogeeks] FACEBOOK ONLINE CODING ROUND

2011-10-19 Thread tin
Can you just generate them sorted? 1 is the minimum 1 << 1 is the next in line 1 << 2 is the next one 1 << N 11 11 << 1 and so on Am i wrong? Il 19/10/2011 19:33, Vandana Bachani ha scritto: Completing it... Got sent before I completed On Wed, Oct 19, 2011 at 12:31 PM, Vandana Bachani mail

Re: [algogeeks] FACEBOOK ONLINE CODING ROUND

2011-10-19 Thread Vandana Bachani
Completing it... Got sent before I completed On Wed, Oct 19, 2011 at 12:31 PM, Vandana Bachani wrote: > Better logic: > create a list array of lists 'arr' (like a hash table with lists). Array > size is N represents 1 to N bits and lists that will increase as we add more > elements to it. a. > fo

Re: [algogeeks] FACEBOOK ONLINE CODING ROUND

2011-10-19 Thread sunny agrawal
No need of creating a tree simply take an array of size 2^N in which all a[i] initialized to i now sort the array first depending upon the set bits in the a[i] if set bits are equal then use value this function call to sort function of algorithms will do the required bool cmp(int x, int y){ int

Re: [algogeeks] FACEBOOK ONLINE CODING ROUND

2011-10-19 Thread Vandana Bachani
Better logic: create a list array of lists (like a hash table with lists). Array size is N represents 1 to N bits and lists that will increase as we add more elements to it. for(i = 1; i < 2^N; i++) { c = count no. of 1s. in i } On Wed, Oct 19, 2011 at 12:16 PM, Vandana Bachani wrote: > Hi,

Re: [algogeeks] FACEBOOK ONLINE CODING ROUND

2011-10-19 Thread sunny agrawal
although input is small so a brute force will also do but some optimization can be like 1. first we can find that how many bits will be set in Kth Codewords using the following method no of codewords with N bits set = 1 no of codewords with N-1 bits set = NC1 no of codewords with N-2 bits set = NC

Re: [algogeeks] FACEBOOK ONLINE CODING ROUND

2011-10-19 Thread Vandana Bachani
Hi, logic: We can work on this problem from the way we construct the sequence. First we generate a binary tree such that each leafnode corresponds to one of the 2^N nodes. We start we an empty root, creating 0, 1 nodes assigning one bit at a time upto N levels (there would be 2^N - leafnodes) but w

[algogeeks] FACEBOOK ONLINE CODING ROUND

2011-10-19 Thread aritra kundu
*Question 1 / 1* Given an integer *N*, there are *2^N* binary codewords of length N. All of them are taken and sorted to create a sequence: Sort by the number of 1-bits in the codeword bit-string. If there is a tie, break tie so that the smaller number comes first in the output sequence *Testcases

Re: [algogeeks] Facebook Interview questions. -- Urgent

2011-09-07 Thread Ishan Aggarwal
Hi... can u plzz tell me about the kind of puzzles they asked u and what sort of coding questions they ask.. What they exactly look for ?? Thank u in advance... On Thu, Sep 8, 2011 at 1:34 AM, Ankit Minglani wrote: > they will give a puzzle kind of problem .. and you will have to code to > outp

Re: [algogeeks] Facebook Interview questions. -- Urgent

2011-09-07 Thread Ankit Minglani
they will give a puzzle kind of problem .. and you will have to code to output the solution .. i think it was a 75 min coding round. On Thu, Sep 8, 2011 at 12:17 AM, Ishan Aggarwal < ishan.aggarwal.1...@gmail.com> wrote: > Do anyone know what kind of questions facebook ask in their coding > inter

[algogeeks] Facebook Interview questions. -- Urgent

2011-09-07 Thread Ishan Aggarwal
Do anyone know what kind of questions facebook ask in their coding interview?? Wht should I prepare... -- 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 g

Re: [algogeeks] Facebook Intern F2F Interview

2011-07-28 Thread Vishal Thanki
+1 Nikhil On Thu, Jul 28, 2011 at 4:26 PM, Nikhil Jindal wrote: > Generate a random number from 1 to 100. > If it is less than or equal to x, return true, else return false. > This will ensure that ur returning true with x/100 probability. > Cheers > Nikhil Jindal > > On Thu, Jul 28, 2011 at 4:21

Re: [algogeeks] Facebook Intern F2F Interview

2011-07-28 Thread Nikhil Jindal
Generate a random number from 1 to 100. If it is less than or equal to x, return true, else return false. This will ensure that ur returning true with x/100 probability. Cheers Nikhil Jindal On Thu, Jul 28, 2011 at 4:21 PM, KK wrote: > bool foo(int x) > > // Implement this function where 0 <= x

Re: [algogeeks] Facebook Intern F2F Interview

2011-07-28 Thread sunny agrawal
@KK can you plz explain the return type of function a bit more what do you mean by It should return true x% of times n false otherwise what is n here (is it "and" or some number) .. On Thu, Jul 28, 2011 at 4:46 PM, Muthu Raj wrote: > Please elaborate upon the question a little more :)

Re: [algogeeks] Facebook Intern F2F Interview

2011-07-28 Thread Muthu Raj
Please elaborate upon the question a little more :) *Muthuraj R. 4TH Year BE.** Information Science Dept* *PESIT, Bengaluru . * On Thu, Jul 28, 2011 at 4:21 PM, KK wrote: > bool foo(int x) > > // Implement this function where 0 <= x <= 100 > It should return true x% of times n false otherwise

[algogeeks] Facebook Intern F2F Interview

2011-07-28 Thread KK
bool foo(int x) // Implement this function where 0 <= x <= 100 It should return true x% of times n false otherwise first i told him to have a static int s then increment it each time the func is called... and if s % (100 - x ) == 0 then true else false. then he told me to have some diff

Re: [algogeeks] Facebook Interview question at NIT Warangal

2011-07-27 Thread Ankur Garg
Hi The solution in the link is of complexity (n*2^n)) Does anyone know any better solution ? Regards Ankur On Tue, Jul 26, 2011 at 11:10 PM, rajeev bharshetty wrote: > @Ankur The link does has a very good explanation. Nice solution :) > > > On Tue, Jul 26, 2011 at 10:47 PM, Kunal Patil wrote:

Re: [algogeeks] Facebook Interview question at NIT Warangal

2011-07-26 Thread rajeev bharshetty
@Ankur The link does has a very good explanation. Nice solution :) On Tue, Jul 26, 2011 at 10:47 PM, Kunal Patil wrote: > @Ankur Garg: Nice explanation at the link given by u... > > > On Tue, Jul 26, 2011 at 10:35 PM, Ankur Garg wrote: > >> Check this >> >> http://codesam.blogspot.com/2011/03/f

Re: [algogeeks] Facebook Interview question at NIT Warangal

2011-07-26 Thread Kunal Patil
@Ankur Garg: Nice explanation at the link given by u... On Tue, Jul 26, 2011 at 10:35 PM, Ankur Garg wrote: > Check this > > http://codesam.blogspot.com/2011/03/find-all-subsets-of-given-set.html > > > On Tue, Jul 26, 2011 at 9:41 PM, Vishal Thanki wrote: > >> Here is the working code.. >> >> #i

Re: [algogeeks] Facebook Interview question at NIT Warangal

2011-07-26 Thread Ankur Garg
Check this http://codesam.blogspot.com/2011/03/find-all-subsets-of-given-set.html On Tue, Jul 26, 2011 at 9:41 PM, Vishal Thanki wrote: > Here is the working code.. > > #include > #include > int a[] = {1,2,3,4,5}; > #define ARRLEN(a) (sizeof(a)/sizeof(a[0])) > void print_comb(int len) > { >

Re: [algogeeks] Facebook Interview question at NIT Warangal

2011-07-26 Thread Vishal Thanki
Here is the working code.. #include #include int a[] = {1,2,3,4,5}; #define ARRLEN(a) (sizeof(a)/sizeof(a[0])) void print_comb(int len) { int tlen = len; int i, j, k; int al = ARRLEN(a); for (i = 0; i < al; i++) { for (j=i+len-1; j wrote: > > check

Re: [algogeeks] Facebook Interview question at NIT Warangal

2011-07-26 Thread praneethn
check this link: *http://www.stefan-pochmann.info/spots/tutorials/sets_subsets/* On Tue, Jul 26, 2011 at 11:59 AM, sumit wrote: > Given an array of size n, print all the possible subset of array of > size k. > eg:- > input: > a[]={1,2,3,4}, k = 2 > output: > 1,2 > 1,3 > 1,4 > 2,3 > 2,4 > 3,4 >

Re: [algogeeks] Facebook Interview question at NIT Warangal

2011-07-26 Thread praneethn
int main() { buildsubsets(0,0,""); } void buildsubsets(int i,int j,String subset) { if(j==k) { cout< wrote: > Given an array of size n, print all the possible subset of array of > size k. > eg:- > input: > a[]={1,2,3,4}, k = 2 > output: > 1,2 > 1,3 > 1,4 > 2

Re: [algogeeks] Facebook Interview question at NIT Warangal

2011-07-26 Thread Shreyas VA
#include #include #include #include int main() { using namespace std; int arr[] = {1,2,3,4}; int k = 2; int n = sizeof(arr)/sizeof(int); vector v(arr, arr+n); int l = pow(2.0, n); for (int i = 0; i < l; ++i) { bitset<32> b(i); if (b.count() != k) continue; for (int j = 0; j < n; ++j) { if (b[j

Re: [algogeeks] Facebook Interview question at NIT Warangal

2011-07-26 Thread Vishal Thanki
anyway, the code i posted is buggy.. doesn't work for "k=3".. don't use it :) On Tue, Jul 26, 2011 at 1:02 PM, Vishal Thanki wrote: > @ankur, i think 1,2 and 2,1 would be same as set theory.. CMMIW. > following is the code.. > > #include > #include > > void print_comb(int *a, int len) > { >    

Re: [algogeeks] Facebook Interview question at NIT Warangal

2011-07-26 Thread Vishal Thanki
@ankur, i think 1,2 and 2,1 would be same as set theory.. CMMIW. following is the code.. #include #include void print_comb(int *a, int len) { int tlen = len; int i, j, k; for (i=0;i<5;i++) { for (j=i+1; j<4;j++) { printf("

Re: [algogeeks] Facebook Interview question at NIT Warangal

2011-07-26 Thread Ankur Garg
Hi Dont u think the subsets will also be {2,1} {3,1} {3,2} {4,1} {4,2} {4,3} On Tue, Jul 26, 2011 at 11:59 AM, sumit wrote: > Given an array of size n, print all the possible subset of array of > size k. > eg:- > input: > a[]={1,2,3,4}, k = 2 > output: > 1,2 > 1,3 > 1,4 > 2,3 > 2,4 > 3,4 > > -

[algogeeks] Facebook Interview question at NIT Warangal

2011-07-25 Thread sumit
Given an array of size n, print all the possible subset of array of size k. eg:- input: a[]={1,2,3,4}, k = 2 output: 1,2 1,3 1,4 2,3 2,4 3,4 -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@google

Re: [algogeeks] facebook

2011-07-05 Thread Harshal
thanks for the info DK. On Wed, Jul 6, 2011 at 11:21 AM, DK wrote: > I've gone through their process. The questions are simpler than those for > Google but they look for a different set of qualities in their hires than > Google so your CV and reccos (if asked) are important. I'm posting via > mo

[algogeeks] facebook

2011-07-05 Thread DK
I've gone through their process. The questions are simpler than those for Google but they look for a different set of qualities in their hires than Google so your CV and reccos (if asked) are important. I'm posting via mobile so I cant post any questions right now. -- DK -- You received this

[algogeeks] facebook

2011-07-05 Thread Harshal
has anyone gone through facebook recruitment process recently? If so, please provide the their process and if possible, the questions they asked... -- Best Regards, Harshal Choudhary 7th Semester, CSE Dept. NIT Surathkal, India. "The road to knowledge runs through the land of confusion." Mobile:

Re: [algogeeks] Facebook Q

2011-06-07 Thread sunny agrawal
Replce all 0's with -1 -1 1 -1 -1 1 1 1 1 -1 perform the following operation a[i] = a[i-1] + a[i] for i = 1 to n-1 -1 0 -1 -2 -1 0 1 2 1 consider first element as 0 0 -1 0 -1 -2 -1 0 1 2 1 hash all these values to an array of size 2n+1 as sum will lie between -n to n where for 2 i&j value hash to s

[algogeeks] Facebook Q

2011-06-07 Thread Piyush Sinha
You have an array of 0s and 1s and you want to output all the intervals (i, j) where the number of 0s and numbers of 1s are equal. Example pos = 0 1 2 3 4 5 6 7 8 arr = 0 1 0 0 1 1 1 1 0 One interval is (0, 1) because there the number of 0 and 1 are equal. There are many other intervals, find a

Re: [algogeeks] Facebook

2011-06-05 Thread Shuaib
Using a data structure such as a queue to manage poping out no more needed records, and adding new ones to the front will reduce the shifting carried out in a simple array based approach. For time difference, store each event's timestamp as epoch time. That requires only one variable and differe

Re: [algogeeks] Facebook

2011-06-05 Thread Shuaib
One function suffices for counting events in the last some amount of minutes. Pass minutes as argument. -- Shuaib http://twitter.com/ShuaibKhan http://www.bytehood.com/ On 03-Jun-2011, at 5:02 PM, Shuaib wrote: > Using a data structure such as a queue to manage poping out no more needed > re

Re: [algogeeks] Facebook

2011-06-03 Thread ankit sambyal
Here is the algo by which I would have approach it : int array[MAX_SIZE]; int top; //global variable which holds the index of the top of the array struct Event { int event_code; int hours; int mins; int seconds;//to hold the time at which the evemt occured }; void recordEvent

[algogeeks] Facebook

2011-06-03 Thread Nate
Question: Design a component that implements the following functionality.. 1) Record an Event (For the sake of simplicity, treat the Event as an integer code) 2) Return the number of Events recorded in the last one minute. 3) Return the number of Events recorded in the last one hour. i.e implement

Re: [algogeeks] Facebook Interview Question from glassdoor

2011-05-23 Thread anshu mishra
for 12 answer will be 36? is it ur question? -- 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 to algogeeks+unsubscr...@googlegroups.co

[algogeeks] Facebook Interview Question from glassdoor

2011-05-23 Thread Dumanshu
Given a telephone number, find all the permutations of the letters assuming 1=abc, 2=def, etc. given solution(probable) :Standard "find all permutations" of XYZ, except for each XYZ, you include permutations for each X0...Xn, Y0...Yn, etc Does this example satisfy everything being asked? eg. te

Re: [algogeeks] Facebook Interview Question....Heavy Number

2011-04-04 Thread anand karthik
I am not sure if I can explain the general approach as efficiently as by explaining with an example: for the example you have give , say to find for A= 1,000,000,000 - 2,000,000,000 first two billion is not heavy. So finding from 1,000,000,000 - 1,999,999,999 It is:( 1 + sigma (x) ) > 70 , where

[algogeeks] Facebook Interview Question....Heavy Number

2011-04-04 Thread bittu
Hi Geeks, One of The My Friend had This Question in His Technical Round of Facebook, I m going to share with you.lest see how geek approach this...Plz don't make this post spam..by discussing whats ur friend name, wich colge, etc etc..just share your approach, think & solve the question, even Goog