[algogeeks] max path
Problem: We have m * n grids. Each grid can have one of earth/water/mines. You can go to top/bottom/left/right adjacent grids. You can go to adjacent grids only when it is filled with earth/mines. you can't travers water filled grids. To travel to adjacent grid you need to sacrifice 2 points. If you travers mines(each mine will have some positive score) the points in that mine will be added to your score. Now given any starting position find out max score loop(end point should be same as start point). P.S. - All mine grid points can be used only once. If you traverse mine second time you won't get any points. -sree -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To unsubscribe from this group and stop receiving emails from it, send an email to algogeeks+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [algogeeks] MS written Reasoning question
Ans is 1 M.A + 2 B.Tech + 2 MBA + 1 MCA. Explanation: (1) Exactly one must be an MA. (2) Given: 2 b.tech are seleceted and the statement if at least one btech is selected then exactly 2 MBA are selected (vice versa condition) So exactly 2 MBA will be selected. (3) Remaining 1 would be MCA. So ans would be (d) option (b) is not correct as it says that only 2 mba and only 1 mca are selected but the total no of selected candidates are 6. -- Ashish On Fri, Apr 26, 2013 at 11:32 PM, rahul sharma rahul23111...@gmail.comwrote: 10 candidates appear for an interview and 6 selected. 2-M.A 2-MCA 4-BTECH 2-MBA. If at least one MBA is selected then exactly 2 btech are selected and vice versa. Of six candidates,exactly one must be an MA cndidate question:- which of the following statementsis definitely true:,if 2 btech are selected: a- two mca and 2 ma are selected. b- only 2 mbas and only one mca is selected c-one MBA and two MAs are selected. d- Two MBAs are selected. My approach:- we are with 2 btech,one ma,one mba remaining two can be 1 mba+1mca or 2 mcas But correct option is d. How is this definitely true and b is not?? plz comment -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To unsubscribe from this group and stop receiving emails from it, send an email to algogeeks+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To unsubscribe from this group and stop receiving emails from it, send an email to algogeeks+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [algogeeks] MS written Reasoning question
b and d cannot be true at the same time. d) - 2 MBA - 2 BTECH - 2 left to allocate. But b) allocates 3 more. On Sat, Apr 27, 2013 at 4:02 AM, rahul sharma rahul23111...@gmail.comwrote: 10 candidates appear for an interview and 6 selected. 2-M.A 2-MCA 4-BTECH 2-MBA. If at least one MBA is selected then exactly 2 btech are selected and vice versa. Of six candidates,exactly one must be an MA cndidate question:- which of the following statementsis definitely true:,if 2 btech are selected: a- two mca and 2 ma are selected. b- only 2 mbas and only one mca is selected c-one MBA and two MAs are selected. d- Two MBAs are selected. My approach:- we are with 2 btech,one ma,one mba remaining two can be 1 mba+1mca or 2 mcas But correct option is d. How is this definitely true and b is not?? plz comment -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To unsubscribe from this group and stop receiving emails from it, send an email to algogeeks+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To unsubscribe from this group and stop receiving emails from it, send an email to algogeeks+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [algogeeks] MS written Reasoning question
(oh sorry forgot to mention - d must be true because of the statement 'if at least one MBA is selected then exactly 2 BTECH are selected and vice versa') On Mon, Apr 29, 2013 at 6:22 AM, Padarn Wilson pad...@gmail.com wrote: b and d cannot be true at the same time. d) - 2 MBA - 2 BTECH - 2 left to allocate. But b) allocates 3 more. On Sat, Apr 27, 2013 at 4:02 AM, rahul sharma rahul23111...@gmail.comwrote: 10 candidates appear for an interview and 6 selected. 2-M.A 2-MCA 4-BTECH 2-MBA. If at least one MBA is selected then exactly 2 btech are selected and vice versa. Of six candidates,exactly one must be an MA cndidate question:- which of the following statementsis definitely true:,if 2 btech are selected: a- two mca and 2 ma are selected. b- only 2 mbas and only one mca is selected c-one MBA and two MAs are selected. d- Two MBAs are selected. My approach:- we are with 2 btech,one ma,one mba remaining two can be 1 mba+1mca or 2 mcas But correct option is d. How is this definitely true and b is not?? plz comment -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To unsubscribe from this group and stop receiving emails from it, send an email to algogeeks+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To unsubscribe from this group and stop receiving emails from it, send an email to algogeeks+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[algogeeks] Scheduling Algo
Design a scheduler to run many functions at different times. It needs to (obviously) be thread-safe. Each task which is scheduled to run will have a time stamp, containing a desired execution time, a function pointer (containing the desired function). Also, find a way to supply the arguments to each function. Implement the mechanisms for scheduling/removing work to be done. *How would you handle functions that must be serialized as opposed to ones that didn't need to be? * * * * * -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To unsubscribe from this group and stop receiving emails from it, send an email to algogeeks+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[algogeeks] Amazon interview Questions
Round 1: 1.Design a Data Structure supporting 3 queries a)push b)pop c) find minimum 2.Given post order of a BST find whether each node of the tree(except leaf) has only 1 child or not. eg5 \ 7 / 3 / 2 is correct as each node has only 1 child. Round 2: 1.Given a sorted array a and a sum k print all pairs of indexes i and j such that a[i]+a[j]=k. 2.Given a matrix that is row and column wise sorted give an algo for finding count of the total no of -ve nos. Round 3: 1.Given a matrix consisting of nos you can print the max length of sequence possible where in a sequence each consecutive nos have a diff of +1 or -1. eg 3 5 7 3 4 5 8 1 6 4 5 2 here sequence is 3 4 5 4 5 2.Give a data structure that supports following queries a)insert b)delete c)ispresent d)print all elements 3.Given a infinite supply of n cylinders where each cylinder is specified by weight of 02,weight of n2,total weight , now u need some minimum quantity of o2 and n2 by selecting cylinders and your aim is make it so that u have min total weight. output the minimum total weight . Round 4: 1.Given 2 sorted arrays find there median. 2.Consider column of ms excel the start with A,BZ,AA Now u r given column no u need to print its name 3.Given 2 arrays.Imagine you are making bst from each array.u need to tell whether 2 bsts will be identical or not without actually constructing the tree. eg 1 2 3 1 3 2 will construct the same tree -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To unsubscribe from this group and stop receiving emails from it, send an email to algogeeks+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[algogeeks] Re: max path
I think I would start by finding the minimum distance between each pair of mines and use that to build a graph where the weight of edge A- B is the value of B minus the cost to get there from A. Finding the maximum cycle in a graph is NP-hard. A greedy algorithm may give a reasonably good solution, but if there are very many mines, finding the best solution becomes very expensive. Don On Apr 29, 6:42 am, sreekanth guru sreekanth.i...@gmail.com wrote: Problem: We have m * n grids. Each grid can have one of earth/water/mines. You can go to top/bottom/left/right adjacent grids. You can go to adjacent grids only when it is filled with earth/mines. you can't travers water filled grids. To travel to adjacent grid you need to sacrifice 2 points. If you travers mines(each mine will have some positive score) the points in that mine will be added to your score. Now given any starting position find out max score loop(end point should be same as start point). P.S. - All mine grid points can be used only once. If you traverse mine second time you won't get any points. -sree -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To unsubscribe from this group and stop receiving emails from it, send an email to algogeeks+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [algogeeks] max path
I think this can be converted into Dijkstra's algorithm to find the minimum distance between the start and end points. (the weights would be negative of the points between two cells). On Mon, Apr 29, 2013 at 4:12 PM, sreekanth guru sreekanth.i...@gmail.comwrote: Problem: We have m * n grids. Each grid can have one of earth/water/mines. You can go to top/bottom/left/right adjacent grids. You can go to adjacent grids only when it is filled with earth/mines. you can't travers water filled grids. To travel to adjacent grid you need to sacrifice 2 points. If you travers mines(each mine will have some positive score) the points in that mine will be added to your score. Now given any starting position find out max score loop(end point should be same as start point). P.S. - All mine grid points can be used only once. If you traverse mine second time you won't get any points. -sree -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To unsubscribe from this group and stop receiving emails from it, send an email to algogeeks+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To unsubscribe from this group and stop receiving emails from it, send an email to algogeeks+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.