Re: [gcj] Re: KickStart 2020 simple problem. Code runs locally, but gets WA on Google's machine

2020-03-25 Thread porker2008
You can change the following code *if len(arr) == 1 and sum(arr) <= budget:* *return 1* to *if sum(arr) <= budget:* *return len(arr)* This is because the loop below assume the sum of the array is greater than *budget *at some point so you need to handle the case where the sum of the a

Re: [gcj] Re: KickStart 2020 simple problem. Code runs locally, but gets WA on Google's machine

2020-03-25 Thread Bartholomew Furrow
Try the single-house case again. What it looks like to me is that you're making small updates to your code, trying to fix particular cases. Instead, take a deep breath, step back, and look at the whole thing. *What was the problem before?* findSol wasn't always returning something. *How can we be

Re: [gcj] Re: KickStart 2020 simple problem. Code runs locally, but gets WA on Google's machine

2020-03-25 Thread Sourakanti Mandal
Thanks a Lot <3 <3 Actually single House was returning NONE, and also it had some problems with house list like [25,25] with a budget of 50. I fixed them, but still it gets WA. Ohh..gosh ! def findSol(arr, budget): if len(arr) == 1 and sum(arr) <= budget: return 1 arr.sort()

Re: [gcj] Re: KickStart 2020 simple problem. Code runs locally, but gets WA on Google's machine

2020-03-24 Thread Bartholomew Furrow
Sourakanti, it took me a few minutes to find what was wrong, and I had to run some testcases. Try testing your code a few ways with just one house. Bartholomew On Tue, Mar 24, 2020 at 6:31 AM Sourakanti Mandal wrote: > And this one gives WA as wellWHY ?? This one is really making me > mad..