Gerenuk
Reputation
1,000
Top tag
Next privilege 2,000 Rep.
 Feb 10 awarded Yearling Jun 9 revised Pick highest score sum, but at least X from each region deleted 1 character in body Jun 9 answered Pick highest score sum, but at least X from each region Jun 9 comment Pick highest score sum, but at least X from each region Sounds good. It's about as far as I got, too :) Comparing regions can be done with early cuts too. But it seem in the end one has to try out most subsets of regions. Once you decide on which regions to include, the task becomes easy, of course. Still, would be interesting to know if there is a magic trick to avoid exhaustively checking most sub-selections of regions. Jun 9 comment Pick highest score sum, but at least X from each region How would you decide which region to include in step 3? You cannot take just the left-most highest score, since if you start a new region, you have to pick X at least. Jun 6 comment Pick highest score sum, but at least X from each region Seems valid, but how do you chose between 3a) and 3b)? 3b has X elements and is always larger than a single element from 3a. And is it possible to prove that the biggest sum (no.3) should always be included? Suppose I have X=2 and I want N=3 from `8A,7A,6B,6B,6B,1A`. I should go for 3xB (=18), but the minimum regions for X=2 told me to favor A. Jun 6 asked Pick highest score sum, but at least X from each region Mar 20 awarded Curious Feb 10 awarded Yearling Feb 4 awarded Famous Question Jan 15 comment Is it always a best practice to write a function for anything that needs to repeat twice? Well, to continue one could say a hard-coded list is not going to appear in the middle of code and will be a variable anyway :) But right, I actually forgot that you can skip the braces there. Jan 13 revised Is it always a best practice to write a function for anything that needs to repeat twice? added 455 characters in body Jan 13 answered Is it always a best practice to write a function for anything that needs to repeat twice? Dec 1 awarded Popular Question Oct 17 awarded Popular Question Jul 14 awarded Popular Question Jun 5 awarded Notable Question Mar 3 awarded Popular Question Feb 10 awarded Yearling Oct 22 awarded Popular Question