Yeah Atul is right..... Here is my solution:-- 1) first rearrange the dimensions of slabs i.e. put bigger dimension in y and smaller dimenson in x (rotate the slab) 2) then arrange all slabs in increasing order of x dimension 3) and then find the longest increasing sub-sequence based on y dimension......
Ex:- (2,5),(5,1),(1,3),(1,2),(6,1) Step-1=> (2,5),(1,5),(1,3),(1,2),(1,6) Step-2=> (1,2),(1,3),(1,5),(1,6),(2,5) Step-3=> LIS=4 { (1,2),(1,3),(1,5),(1,6) OR (1,2),(1,3),(1,5),(2,5) } Correct me if i wrong... On Sun, Aug 26, 2012 at 3:54 PM, atul anand <atul.87fri...@gmail.com> wrote: > its a LIS problem. > > need to think for n-dimension... > > On 8/26/12, Ravi Ranjan <ravi.cool2...@gmail.com> wrote: > > You are given many slabs each with a length and a breadth. A slab i can > be > > put on slab j if both dimensions of i are less than that of j. In this > > similar manner, you can keep on putting slabs on each other. Find the > > maximum stack possible which you can create out of the given slabs > > > > and for general n-dimesions > > > > -- > > 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. > > -- -- ‘Kailash Bagaria’ B-tech 4th year Computer Science & Engineering Indian Institute of Technology, Roorkee Roorkee, India (247667) -- 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.