Re: [algogeeks] Microsoft online questions
hi can u please elaborate on analytical questions.like if they were from logical reasoning,verbal(syllogism) and in technical...were questions based on output of c programs...or there were data structures nd other topics plz help...it will be a great help ... . Thanx On Sun, Jul 29, 2012 at 9:58 PM, Purani Sekar nagapur...@gmail.com wrote: Hi, They conducted 2 online rounds. First round was of 1 hour duration. It tests your speed and analytical skills. The mark split was as given below: 30 analytical questions - data interpretation type 20 technical questiions - flow chart and basic c Second round was online coding round. But compiler will not be provided. It will be like typing a code in notepad. On Sun, Jul 29, 2012 at 4:56 PM, Sanchit Mittal since1991sanc...@gmail.com wrote: Hi, Can anybody help by sharing MS online test pattern and questions ? I have heard they have also included aptitude questions this time, is that right? Thanks -- Sanchit Mittal Fourth Year Undergraduate Computer Engineering Delhi College of Engineering ph- +919582414494 -- 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.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Microsoft online questions
I think they asked same questions for intern and full time. The second round questions were: 1. given a string , remove the duplicates and print it in ascending order eg : accommodate op: acdemot 2. given a sorted array with a few numbers in between reversed. fix the array eg : 1 2 3 4 9 8 7 11 12 14 op :1 2 3 4 7 8 9 11 12 14 3. convert sorted doubly linked list to bst using same nodes as in DLL. again 3 questions. written. 1hr. 1. given a number N and an array, find the tuples in the array that have a difference equal to N 2. insert a value into a sorted circular singly linked list 3. given a node N, find the left most node in the BST in the level that contains N. eg: 7 / \ 5 9 / \ /\ 1 4 8 12 given node N : 8 output : 1 On Sun, Jul 29, 2012 at 9:38 PM, Tanuj Makkar tanujmakkar.de...@gmail.com wrote: Also if smeone cn post some questions/experience for microsoft intern/placementit will be a grt help Thanks Tanuj Makkar Delhi College Of Engineering -- 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/-/hLscLeYPBXQJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Facebook Interview Question
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 to final configuration. You are required to do the transformations in minimal number of moves. A move consists of picking the topmost disc of any one of the pegs and placing it on top of anyother peg. At anypoint of time, the decreasing radius property of all the pegs must be maintained. Constraints: 1= N=8 3= K=5 Input Format: N K 2nd line contains N integers. Each integer in the second line is in the range 1 to K where the i-th integer denotes the peg to which disc of radius i is present in the initial configuration. 3rd line denotes the final configuration in a format similar to the initial configuration. Output Format: The first line contains M - The minimal number of moves required to complete the transformation. The following M lines describe a move, by a peg number to pick from and a peg number to place on. If there are more than one solutions, it's sufficient to output any one of them. You can assume, there is always a solution with less than 7 moves and the initial confirguration will not be same as the final one. Sample Input #00: 2 3 1 1 2 2 Sample Output #00: 3 1 3 1 2 3 2 Sample Input #01: 6 4 4 2 4 3 1 1 1 1 1 1 1 1 Sample Output #01: 5 3 1 4 3 4 1 2 1 3 1 -- *Regards* Mahendra Pratap Singh Sengar B-tech 4/4 NIT Warangal. Facebook ID http://www.facebook.com/mkingmahi -- 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.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Facebook Interview Question
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 to final configuration. You are required to do the transformations in minimal number of moves. A move consists of picking the topmost disc of any one of the pegs and placing it on top of anyother peg. At anypoint of time, the decreasing radius property of all the pegs must be maintained. Constraints: 1= N=8 3= K=5 Input Format: N K 2nd line contains N integers. Each integer in the second line is in the range 1 to K where the i-th integer denotes the peg to which disc of radius i is present in the initial configuration. 3rd line denotes the final configuration in a format similar to the initial configuration. Output Format: The first line contains M - The minimal number of moves required to complete the transformation. The following M lines describe a move, by a peg number to pick from and a peg number to place on. If there are more than one solutions, it's sufficient to output any one of them. You can assume, there is always a solution with less than 7 moves and the initial confirguration will not be same as the final one. Sample Input #00: 2 3 1 1 2 2 Sample Output #00: 3 1 3 1 2 3 2 Sample Input #01: 6 4 4 2 4 3 1 1 1 1 1 1 1 1 Sample Output #01: 5 3 1 4 3 4 1 2 1 3 1 -- 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/-/wR-n5NDKpoQJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: Directi Interview Ques
@Prakhar Jain I believe that the following recurrence shall solve it.. Take an array C[n+1][n+1]... Now, we only need to calculate those C[i][j]'s where i+j is even.. // Assuming 1-based index... Initialization condition... C[0][0]=0; for(int i =0; i =n; i+=2) { C[0][i] = C[0][i-2] + B[i] * B[i-1]; } for(int i =0; i =n; i+=2) { C[i][0] = C[i-2][0] + A[i] * A[i-1]; } Calculating the values of C.. for(int i =1; i =n; ++i) for(int j =1; j =n; ++j) { if( (i+j)%2 = 0 ) { C[i][j] = max { C[i-2][j] + A[i-1] * A[i] , // if(i-2 =0) C[i-1][j-1] + A[i] * B[j] , // if(i-1 =0 j-1 =0) C[i][j-2] + B[i-1] * B[i] // if( j-2 =0) } ; } } Answer : Maximum value - C[n][n] On 10 July, 08:13, Prakhar Jain jprakha...@gmail.com wrote: You are given 2 arrays of size 'n' each. You need to stable-merge these arrays such that in the new array sum of product of consecutive elements is maximized. eg A= { 2, 1, 3} B= { 3, 7, 9} Stable merging A and B will give an array C with '2n' elements say C={c1, c2, c3, c4, c5, c6} You need to find a new array C by merging (stable) A and B such that sum= c1*c2 + c3*c4 + c5* c6. n terms is maximum. -- Prakhar Jain IIIT Allahabad B.Tech IT 3rd Year Mob no: +91 9454992196 E-mail: rit2009...@iiita.ac.in jprakha...@gmail.com -- 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.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: Directi Written Q 2012
int func(int start,int end) { int count=0; for(int i=start;i=end;i++) { int tmp=i; while(tmp!=0) { tmp=tmp(tmp-1); count++; } } return count; } Worst Case complexity : O((b-a)*32) Please let me know if there is another gud way to do it.. :) On Tuesday, 24 July 2012 15:09:42 UTC+5:30, ruru wrote: find no. of 1's in binary format of numbers from 1 to 100. like for 1 to 10 answer is 17 On Tuesday, 24 July 2012 15:09:42 UTC+5:30, ruru wrote: find no. of 1's in binary format of numbers from 1 to 100. like for 1 to 10 answer is 17 -- 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/-/WrMDDsQp1BoJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: Directi Interview Ques
@small correction: In the initialization condition the loop index i shall start from 2 and not 0.. // for(int i =2; i =n; i+=2) On 30 July, 15:23, Lucifer sourabhd2...@gmail.com wrote: @Prakhar Jain I believe that the following recurrence shall solve it.. Take an array C[n+1][n+1]... Now, we only need to calculate those C[i][j]'s where i+j is even.. // Assuming 1-based index... Initialization condition... C[0][0]=0; for(int i =0; i =n; i+=2) { C[0][i] = C[0][i-2] + B[i] * B[i-1];} for(int i =0; i =n; i+=2) { C[i][0] = C[i-2][0] + A[i] * A[i-1]; } Calculating the values of C.. for(int i =1; i =n; ++i) for(int j =1; j =n; ++j) { if( (i+j)%2 = 0 ) { C[i][j] = max { C[i-2][j] + A[i-1] * A[i] , // if(i-2 =0) C[i-1][j-1] + A[i] * B[j] , // if(i-1 =0 j-1 =0) C[i][j-2] + B[i-1] * B[i] // if( j-2 =0) } ; } } Answer : Maximum value - C[n][n] On 10 July, 08:13, Prakhar Jain jprakha...@gmail.com wrote: You are given 2 arrays of size 'n' each. You need to stable-merge these arrays such that in the new array sum of product of consecutive elements is maximized. eg A= { 2, 1, 3} B= { 3, 7, 9} Stable merging A and B will give an array C with '2n' elements say C={c1, c2, c3, c4, c5, c6} You need to find a new array C by merging (stable) A and B such that sum= c1*c2 + c3*c4 + c5* c6. n terms is maximum. -- Prakhar Jain IIIT Allahabad B.Tech IT 3rd Year Mob no: +91 9454992196 E-mail: rit2009...@iiita.ac.in jprakha...@gmail.com -- 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.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: Directi Written Q 2012
@ ruru I think we can do it in log(n).. I am not jolting down the code but giving out the idea that would lead to log(n) time.. If we write down all the nos. in the binary format one below the other.. we will observe the following pattern :- at bit index '1' the bit value toggles in group of '01' at bit index '2' the bit value toggles in group of '0011' ans so on.. Hence using basic divisibility property we can calculate the no. of one's at every it index 'i' where 'i' ranges from 1 to log(N).. On 30 July, 15:25, Zyro vivkum...@gmail.com wrote: int func(int start,int end) { int count=0; for(int i=start;i=end;i++) { int tmp=i; while(tmp!=0) { tmp=tmp(tmp-1); count++; } } return count; } Worst Case complexity : O((b-a)*32) Please let me know if there is another gud way to do it.. :) On Tuesday, 24 July 2012 15:09:42 UTC+5:30, ruru wrote: find no. of 1's in binary format of numbers from 1 to 100. like for 1 to 10 answer is 17 On Tuesday, 24 July 2012 15:09:42 UTC+5:30, ruru wrote: find no. of 1's in binary format of numbers from 1 to 100. like for 1 to 10 answer is 17 -- 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.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: Facebook Interview Question
@Mahendra Sengar.. We can solve it by interpreting it as a graph problem (as N and K are small). Lets say that :- a) Each node in the graph defines a particular state of the disks and the pegs. b) Each edge in the graph defines a valid transition from one state to another and weight of each edge is 1. Now, we can choose to do a on-the-fly bfs to find the minimum path from start node to the end node, where end node is nothing but the state of the final configuration. The on-the-fly approach works fine because we know that a solution exists and is 7, that the the total path cannot be =7. and hence we don't need to initially generate all the valid states of the (disks,pegs) and then create a graph out of it. Rather, we can select the start node and then figure out the nodes that a 1-edge far from it, to carry on with the bfs approach. On 30 July, 15:17, Mahendra Sengar sengar.m...@gmail.com wrote: 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 to final configuration. You are required to do the transformations in minimal number of moves. A move consists of picking the topmost disc of any one of the pegs and placing it on top of anyother peg. At anypoint of time, the decreasing radius property of all the pegs must be maintained. Constraints: 1= N=8 3= K=5 Input Format: N K 2nd line contains N integers. Each integer in the second line is in the range 1 to K where the i-th integer denotes the peg to which disc of radius i is present in the initial configuration. 3rd line denotes the final configuration in a format similar to the initial configuration. Output Format: The first line contains M - The minimal number of moves required to complete the transformation. The following M lines describe a move, by a peg number to pick from and a peg number to place on. If there are more than one solutions, it's sufficient to output any one of them. You can assume, there is always a solution with less than 7 moves and the initial confirguration will not be same as the final one. Sample Input #00: 2 3 1 1 2 2 Sample Output #00: 3 1 3 1 2 3 2 Sample Input #01: 6 4 4 2 4 3 1 1 1 1 1 1 1 1 Sample Output #01: 5 3 1 4 3 4 1 2 1 3 1 -- 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.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: Facebook Interview Question
@above.. In case the no of nodes that are placed at the certain height from the start node are growing at an extremely fast rate, we can instead use a dfs approach as well. On 30 July, 18:13, Lucifer sourabhd2...@gmail.com wrote: @Mahendra Sengar.. We can solve it by interpreting it as a graph problem (as N and K are small). Lets say that :- a) Each node in the graph defines a particular state of the disks and the pegs. b) Each edge in the graph defines a valid transition from one state to another and weight of each edge is 1. Now, we can choose to do a on-the-fly bfs to find the minimum path from start node to the end node, where end node is nothing but the state of the final configuration. The on-the-fly approach works fine because we know that a solution exists and is 7, that the the total path cannot be =7. and hence we don't need to initially generate all the valid states of the (disks,pegs) and then create a graph out of it. Rather, we can select the start node and then figure out the nodes that a 1-edge far from it, to carry on with the bfs approach. On 30 July, 15:17, Mahendra Sengar sengar.m...@gmail.com wrote: 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 to final configuration. You are required to do the transformations in minimal number of moves. A move consists of picking the topmost disc of any one of the pegs and placing it on top of anyother peg. At anypoint of time, the decreasing radius property of all the pegs must be maintained. Constraints: 1= N=8 3= K=5 Input Format: N K 2nd line contains N integers. Each integer in the second line is in the range 1 to K where the i-th integer denotes the peg to which disc of radius i is present in the initial configuration. 3rd line denotes the final configuration in a format similar to the initial configuration. Output Format: The first line contains M - The minimal number of moves required to complete the transformation. The following M lines describe a move, by a peg number to pick from and a peg number to place on. If there are more than one solutions, it's sufficient to output any one of them. You can assume, there is always a solution with less than 7 moves and the initial confirguration will not be same as the final one. Sample Input #00: 2 3 1 1 2 2 Sample Output #00: 3 1 3 1 2 3 2 Sample Input #01: 6 4 4 2 4 3 1 1 1 1 1 1 1 1 Sample Output #01: 5 3 1 4 3 4 1 2 1 3 1 -- 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.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Facebook Interview Question
Well as far as I Knw this is the typical question which Amazon was know to ask frequently ... the reason behind this is simple to see how is the peoples approach. However the right answer of this question is yet to found ... its under research... On Mon, Jul 30, 2012 at 6:46 PM, Lucifer sourabhd2...@gmail.com wrote: @above.. In case the no of nodes that are placed at the certain height from the start node are growing at an extremely fast rate, we can instead use a dfs approach as well. On 30 July, 18:13, Lucifer sourabhd2...@gmail.com wrote: @Mahendra Sengar.. We can solve it by interpreting it as a graph problem (as N and K are small). Lets say that :- a) Each node in the graph defines a particular state of the disks and the pegs. b) Each edge in the graph defines a valid transition from one state to another and weight of each edge is 1. Now, we can choose to do a on-the-fly bfs to find the minimum path from start node to the end node, where end node is nothing but the state of the final configuration. The on-the-fly approach works fine because we know that a solution exists and is 7, that the the total path cannot be =7. and hence we don't need to initially generate all the valid states of the (disks,pegs) and then create a graph out of it. Rather, we can select the start node and then figure out the nodes that a 1-edge far from it, to carry on with the bfs approach. On 30 July, 15:17, Mahendra Sengar sengar.m...@gmail.com wrote: 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 to final configuration. You are required to do the transformations in minimal number of moves. A move consists of picking the topmost disc of any one of the pegs and placing it on top of anyother peg. At anypoint of time, the decreasing radius property of all the pegs must be maintained. Constraints: 1= N=8 3= K=5 Input Format: N K 2nd line contains N integers. Each integer in the second line is in the range 1 to K where the i-th integer denotes the peg to which disc of radius i is present in the initial configuration. 3rd line denotes the final configuration in a format similar to the initial configuration. Output Format: The first line contains M - The minimal number of moves required to complete the transformation. The following M lines describe a move, by a peg number to pick from and a peg number to place on. If there are more than one solutions, it's sufficient to output any one of them. You can assume, there is always a solution with less than 7 moves and the initial confirguration will not be same as the final one. Sample Input #00: 2 3 1 1 2 2 Sample Output #00: 3 1 3 1 2 3 2 Sample Input #01: 6 4 4 2 4 3 1 1 1 1 1 1 1 1 Sample Output #01: 5 3 1 4 3 4 1 2 1 3 1 -- 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.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Binomial Coefficients
Hey Guys, how to solve this problem where the input size is 500 digit Integer?? https://www.interviewstreet.com/challenges/dashboard/#problem/4fe19c4f35a0e -- 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.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Binomial Coefficients
Python has no int limits On Mon, Jul 30, 2012 at 11:27 AM, shiva@Algo shiv.jays...@gmail.com wrote: Hey Guys, how to solve this problem where the input size is 500 digit Integer?? https://www.interviewstreet.com/challenges/dashboard/#problem/4fe19c4f35a0e -- 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.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: Directi Interview Ques
@vivek.. u can't sort.. its a stable merge... The question is to stably merge the two arrays..the stable merge of the 2 arrays can take place in (2n C n) ways.. 1 of these arrangements will lead to the maximum sum.. We are required to find that sequence/maxsum.. A stable merge in this case is nothing but interleaved arrangement of the 2 arrays.. for ex- A= { a1, a2, a3} B= { b1, b2, b3} Stable merges: -- C = { a1,b1,a2,b2,b3,a3} or say, C = { b1,a1,a2,b2,a3,b3} The above array is formed by stable merge because the order of 'a's and 'b's in the merged array is intact.. i.e a1 comes before a2 which in turn comes before a3 .. same goes for b1,b2,b3.. Unstable merge: C = { a2,b1,a1,b2,b3,a3} // here a2 is placed before a1.. hence not stable... On 30 July, 19:56, vivek veldandi vivek.veldandi...@gmail.com wrote: On Mon, Jul 30, 2012 at 3:56 PM, Lucifer sourabhd2...@gmail.com wrote: @small correction: In the initialization condition the loop index i shall start from 2 and not 0.. // for(int i =2; i =n; i+=2) On 30 July, 15:23, Lucifer sourabhd2...@gmail.com wrote: @Prakhar Jain I believe that the following recurrence shall solve it.. Take an array C[n+1][n+1]... Now, we only need to calculate those C[i][j]'s where i+j is even.. // Assuming 1-based index... Initialization condition... C[0][0]=0; for(int i =0; i =n; i+=2) { C[0][i] = C[0][i-2] + B[i] * B[i-1];} for(int i =0; i =n; i+=2) { C[i][0] = C[i-2][0] + A[i] * A[i-1]; } Calculating the values of C.. for(int i =1; i =n; ++i) for(int j =1; j =n; ++j) { if( (i+j)%2 = 0 ) { C[i][j] = max { C[i-2][j] + A[i-1] * A[i] , // if(i-2 =0) C[i-1][j-1] + A[i] * B[j] , // if(i-1 =0 j-1 =0) C[i][j-2] + B[i-1] * B[i] // if( j-2 =0) } ; } } Answer : Maximum value - C[n][n] On 10 July, 08:13, Prakhar Jain jprakha...@gmail.com wrote: You are given 2 arrays of size 'n' each. You need to stable-merge these arrays such that in the new array sum of product of consecutive elements is maximized. eg A= { 2, 1, 3} B= { 3, 7, 9} Stable merging A and B will give an array C with '2n' elements say C={c1, c2, c3, c4, c5, c6} You need to find a new array C by merging (stable) A and B such that sum= c1*c2 + c3*c4 + c5* c6. n terms is maximum. -- Prakhar Jain IIIT Allahabad B.Tech IT 3rd Year Mob no: +91 9454992196 E-mail: rit2009...@iiita.ac.in jprakha...@gmail.com -- 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.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. sort them and merge..u will get max in all cases -- 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.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Binomial Coefficients
Cant we do in c++??Any smart algo On Mon, Jul 30, 2012 at 9:14 PM, Kishore kkishoreya...@gmail.com wrote: Python has no int limits On Mon, Jul 30, 2012 at 11:27 AM, shiva@Algo shiv.jays...@gmail.comwrote: Hey Guys, how to solve this problem where the input size is 500 digit Integer?? https://www.interviewstreet.com/challenges/dashboard/#problem/4fe19c4f35a0e -- 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.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.