Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Thanks for enjoying :)
Python version broken (see below)
Ok, I'll raise an issue and you can resolve it when fixed.
Hi,
Possibly a mistake from on my side, but can I just check that the Python version is correct?
What does the C++ version get for this test case? I get 118 but the expected answer is 120.
[252675239, 362192384, 382111017, 102436662, 804562879, 67875051, 918098597, 550760272, 672682358, 562441881, 244526967, 988445274, 466603325, 299923249, 610523466, 787257402, 693127002, 251117314, 274854186, 132680743, 37459911, 14834957, 356231355, 335781937, 858812500, 458441030, 637311869, 73745211, 791787211, 861578469, 303806301, 600898913, 774940912, 507068751, 899220219, 277356214, 377089866, 89899198, 562096927, 685989640, 69944625, 412794039, 821294229, 573899793, 98368861, 410483038, 506027728, 150314858, 975884181, 748126866, 911792198, 337223145, 759500864, 502300412, 406805122, 167525438, 391836287, 320020089, 866141493, 665536709, 450230733, 409647119, 790920766, 376319592, 758002143, 847823692, 52201469, 322112020, 815885044, 918761827, 62364468, 751740058, 493245527, 498082433, 758828960, 607493212, 289831800, 467744000, 117178299, 156008901, 358090920, 473442205, 706432727, 187103, 101678660, 595372718, 946560762, 904900923, 872198964, 923598946, 93254700, 964102678, 822079129, 853742706, 705540492, 825356904, 616340042, 403197242, 511851652, 959117247, 880360930, 692982960, 744805904, 582350530, 846408292, 251199337, 860645266, 399052838, 367146139, 811071120, 86066388, 537042740, 867961536, 758098684, 235224287, 380599736, 959657936, 203694131, 15459309, 444249517, 230214952, 127024582, 789638186, 771424527, 40829331, 63146714, 59506, 411956640, 110991310, 720172051, 788647540, 667417108, 121734674, 632863051, 55666913, 240211076, 604460690, 801651972, 896855229, 59706928]
For the answer, I sum the ranges:
0: 1, 1: 2, 2: 3, 3: 5, 5: 7, 7: 10, 10: 14, 14: 17, 17: 25, 25: 30, 30: 35, 35: 43, 43: 50, 50: 57, 57: 63, 63: 70, 70: 80, 80: 89, 89: 96, 96: 104, 104: 114, 114: 140
Which gives final array
[252675239, 362192384, 382111017, 906999541, 985973648, 1785884511, 1999498815, 2090907870, 2261772903, 2822863790, 3085935096, 3296464738, 3463105325, 3476983466, 3502496909, 4091105787, 4202517658, 4958864982, 5187675555, 5391006507, 5784692340, 10373557896]
There can be multiple correct solutions but you only accept one. For example in the sample tests:
'--|7kg|--------------------|2kg||19kg|--' should equal '--|10kg||3kg|--------------|7kg||11kg|--'
, and'--|126kg||122kg|--------|123kg||134kg|--' should equal '--|211kg|----------------------|287kg|--'
.Either specify a total ordering for answers and make the user return the best answer according to the ordering, or make the tests allow all correct answers.
Also, it seems like you only want to accept an equal number of weights on either side but this is not written anywhere in the description. For example, getting these in the random tests:
'--|13kg|------------------|11kg||20kg|--' should equal ':('
, and'--------------------------------|13kg|--' should equal ':('
.In the description, you say "with the heaviest Weight on the left!!!", but both the description and tests expect the heaviest on the right.
This comment is hidden because it contains spoiler information about the solution
Looks good!
Also, I think you may have forgotton to change the sample tests.
Also, would you be able to create a function to do a test?
Instead of having to repeat this everytime:
Makes it a lot easier to maintain.
This comment is hidden because it contains spoiler information about the solution
Seems ok, but you should use
test.fail
instead of raising an error if the user's solution is incorrect:https://docs.codewars.com/languages/python/codewars-test#pass-and-fail
.(and
test.pass_
instead oftest.assert_equals(True, True)
)Hi, you should resolve issues only after they have actually been resolved :P
The description says both inputs will be prime, but 9991 given in the sample tests is not prime.
There are some inputs that can have multiple valid solutions for example, with the second sample test:
[3361, 3371, 3571, 1571, 1579, 1979] should equal [3361, 1361, 1861, 1871, 1879, 1979]
.You should probably create a function that checks whether the user's solution is valid, rather than using
test.assert_equals
.A bit late, but you can use something like a
std::sync::atomic::AtomicU16
or just astatic mut u16
as like a question counter, and then just return false when that counter hits a certain value.The only slight issue is that Rust tests are run in parallel, but I'm assuming only one of the test categories are timing out, so this should be fine.
Loading more items...