[algogeeks] Re: Microsoft - DP problem

2011-01-20 Thread Davin
static int MaxLoot(int[] A, int n) { int[] S = new int[n]; S[0] = A[0]; S[1] = A[1]; S[2] = S[0] + A[2]; int maxloot = Math.Max(S[1], S[2]); for (int i = 3; i n; i++) { S[i] =

[algogeeks] Re: Sort string based upon the count of characters

2011-01-13 Thread Davin
, Jan 13, 2011 at 11:53 AM, Davin dkthar...@googlemail.com wrote: Smaple Data : input : abcdacdc Output : cadb If the count is same for  characters. maintain the original order of the characters from input string. Please do let me know for any clarification. -- You received

[algogeeks] Re: Sort string based upon the count of characters

2011-01-13 Thread Davin
cab As 'c' and 'a' have same count but 'c' was before 'a' in the input string. On Jan 13, 1:39 pm, juver++ avpostni...@gmail.com wrote: @Davin. Please provide an example of output for this - cabbaacc -- You received this message because you are subscribed to the Google Groups Algorithm

[algogeeks] Re: Sort string based upon the count of characters

2011-01-13 Thread Davin
@juver++ Thanks for hint. Problem solved. On Jan 13, 1:48 pm, juver++ avpostni...@gmail.com wrote: @Davin maintain count of each character, along with the first occurence of it in the string. then write your own comparator and run sort using it -- You received this message because you

[algogeeks] Re: MICROSOFT IDC

2011-01-12 Thread Davin
1) Get count of the nodes in first list, let count be c1. 2) Get count of the nodes in second list, let count be c2. 3) Get the difference of counts d = abs(c1 – c2) 4) Now traverse the bigger list from the first node till d nodes so that from here onwards both the lists have equal no of nodes. 5)

[algogeeks] Re: MICROSOFT IDC

2011-01-12 Thread Davin
@manoj, Can you please explain question about your understanding? On Jan 12, 4:19 pm, manoj manoj.lala...@gmail.com wrote: wake up ..L I think original question has asked about intersection (set intersection)...not the node intersection of two linked list. On Jan 12, 4:04 pm,

[algogeeks] Sort string based upon the count of characters

2011-01-12 Thread Davin
Smaple Data : input : abcdacdc Output : cadb If the count is same for characters. maintain the original order of the characters from input string. Please do let me know for any clarification. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group.

[algogeeks] Re: Strings search problem

2010-12-30 Thread Davin
Find the area with less distance between words. Distance is measured words count in between two words. On Dec 30, 4:08 pm, 周翔 csepark...@gmail.com wrote: Distance is measured on number of words. what is your meaning ?  can you explain it? 2010/12/29 Davin dkthar...@googlemail.com

[algogeeks] Strings search problem

2010-12-29 Thread Davin
Given set of words, find an area of the text where these words are as close to each other as possible. Distance is measured on number of words. e.g. for words [rat”, “jat”, “pat”] and text “rat stop the pat blah blah jat by pat jat tra la la” such area is “cat by mat bat” -- You received this

[algogeeks] Array Ranking Problem

2010-12-23 Thread Davin
Problem Definition : Find minimum time X from set of questions to pass the exam : Input : Array of Marks [0, n-1] corresponding Array of Time of Each Questions[0, n-1]. Thanks for help in advance. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks

[algogeeks] Re: Array Ranking Problem

2010-12-23 Thread Davin
Marks for Questions(1,6): {10,15,20,25,10,20} Time for Each Questions(1,6) : { 2, 4,3,4, 2,4} Passing Marks : 40 Out of 100 Find Questions with minimum time to pass the exam? On Dec 23, 7:04 pm, juver++ avpostni...@gmail.com wrote: Please clarify the problem statement. Provide example. From

[algogeeks] Re: Array Ranking Problem

2010-12-23 Thread Davin
Thanks for reply. I am looking for O(n) for solution. Davin On Dec 23, 8:29 pm, snehal jain learner@gmail.com wrote: hint : use dp On Thu, Dec 23, 2010 at 8:30 PM, Davin dkthar...@googlemail.com wrote: Marks for Questions(1,6): {10,15,20,25,10,20} Time for Each Questions(1,6