Re: [algogeeks] Re: Facebook Interview Question....Heavy Number

2012-04-06 Thread Hemesh Singh
http://codegolf.stackexchange.com/questions/2952/count-number-of-hefty-decimals-between-2-numbers -- 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,

[algogeeks] Re: Facebook Interview Question....Heavy Number

2011-04-25 Thread pankaj do it
best approach for such problems is try to solve for very small numbers then do DP for solve large numbers. as follows single digit = 7,8,9 answer = 3 [i am taking 7 inclussive] double digit= 7*2 = 14. now smallest number can be. 59=1 68, 69 = 2 77 78, 79,=3 86, 87, 88, 89=4 95,96,97,98,99 =5 3

Re: [algogeeks] Re: Facebook Interview Question....Heavy Number

2011-04-06 Thread Nikhil Jindal
Ok. Here's a possible O(n) solution. Assuming last digit of a is 0. for(n=a;n=b;n+=10) { Calculate the sum of digits, leaving the last digit. Find the minimum value of last digit for it to be a heavy number. Increment count by 10-that number. } So here, complexity will be: O(n/10*(d-1)) where, d

[algogeeks] Re: Facebook Interview Question....Heavy Number

2011-04-05 Thread bittu
@all , Nikhi Jindal ,.as i already told that O(n^2) Solution is Obvious ..but .it wont work for 1Biillion as a time limit exceeds , memory Error occur, so its not a good solution ..I think There is DP Solution Exist For Thats We Need to Figure it Out to resolve this problem @anand what r u

[algogeeks] Re: Facebook Interview Question....Heavy Number

2011-04-05 Thread James Curran
OK, here's my rather rambling theory on how to approach it: First break the range down into a series of smaller ranges into form: xxyzz where: xx is 0 to n digits which are fixed throughout the range. y is 0 or 1 digit in the range 0..n or m..9 (with a special case *) zz is 0 to n digits in

RE: [algogeeks] Re: Facebook Interview Question....Heavy Number

2011-04-05 Thread Hamilton Verissimo de Oliveira
Hey James Would that work equally well for 59 up to 1000? Sent from my Windows Phone From: James Curran Sent: Tuesday, April 05, 2011 7:50 AM To: Algorithm Geeks Subject: [algogeeks] Re: Facebook Interview QuestionHeavy Number OK, here's my rather rambling theory on how to approach

Re: [algogeeks] Re: Facebook Interview Question....Heavy Number

2011-04-05 Thread Vetri Vel
Hey , i m a new follower to this group.. i was actually looking for a nice group that would contain a nice challenge to sharpen the brain. and i finally ended with this group... i m happy to follo this group along with geeks like you. -- You received this message because you are subscribed to

Re: [algogeeks] Re: Facebook Interview Question....Heavy Number

2011-04-05 Thread James Curran
to 1000? Sent from my Windows Phone From: James Curran Sent: Tuesday, April 05, 2011 7:50 AM To: Algorithm Geeks Subject: [algogeeks] Re: Facebook Interview QuestionHeavy Number OK, here's my rather rambling theory on how to approach it: First break the range down into a series