[algogeeks] Re: coding round question
@Vikas, I think the brute force here will be combinatorial , you need to calculate all the combinations of lucky say 4, 7, 47, 74 and then try to find all of the moves combination which maximize this lucky array index, may be from last to first, just for little optimization. A bit tough for the interview :) On Oct 30, 7:48 pm, aniket chatterjee aniket...@gmail.com wrote: +1 On Sun, Oct 30, 2011 at 6:53 AM, Siddhartha Banerjee thefourrup...@gmail.com wrote: could you please explain the question in a bit more detail? especially the partThere are some particular numbers which are made using 4 or 7 : any combination of 4 and 7 are accepted. from what i understand of the question, there are some intervals given... we can move the intervals left or right by one unit, any such movement counts as one move... we have to move the segments in such a way that it maximizes the maximum number of segments where a number can lie...the maximum number of moves allowed are given... is that true??? by the way, which company's coding round was it??? -- 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: coding round question
The question was from startup company verego (may be misspelled), you understood it in correct way. We are given 'k' number of ranges in the fashion L, R they are all integers in big ranges , (assume long long for the case) then we are given move operation defined as move( i, +1/-1) : so range (i) will be moved to +1/-1 : (L+1/-1, R +1/-1) maximum number of move attempts can be 'n' provided as input some numbers are defined as lucky , in this case interviewer said all combinations of 4 and 7 are lucky e.g. 4 7 47 74 447 474 . tweak is a number which is lucky and lies in all ranges ( could be after you have exausted all the moves ) so we need to use the move in such a way which maximize the tweaks. He told me to write a brute force for this but even that shook me . Can any one want to discuss what could be possible approaches for this question ? On Oct 30, 6:53 pm, Siddhartha Banerjee thefourrup...@gmail.com wrote: could you please explain the question in a bit more detail? especially the partThere are some particular numbers which are made using 4 or 7 : any combination of 4 and 7 are accepted. from what i understand of the question, there are some intervals given... we can move the intervals left or right by one unit, any such movement counts as one move... we have to move the segments in such a way that it maximizes the maximum number of segments where a number can lie...the maximum number of moves allowed are given... is that true??? by the way, which company's coding round was it??? -- 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.