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.
This was fun, honestly it's been a while since a last code, eveen if this is a simple problem i forgot somethings and was to lazy to look for the error (I didn't consider same numbers, what start a infine loop), so i just try codding again. This help me get a little more used to javaScript, since to the language I'm a complete begginer and the best part was to see in the end those codes with less then 10 lines doing exact the samething as I did but with 70 more lines ehehheeheh. Thanks for the Kata.
Yes, it has been accepted now, thanks
There is no way to increase the 12 second limit. It's a codewars rule that every problem has to complete within that time.
To get a more efficient algorithm, generalize the process described in the example.
PickCormac, please try your solution again. It should be successful.
"Performance should not be an issue". Performance is in fact as an issue as inefficient alogrithms time out. Would it be possible to increase the time before timeout?
Edit: Admittedly my algorithm is as inefficent as is possibly possible. Thats a mouthful.
I believe you are correct! The C# (and the Java and Swift translations) are overlooking solutions where the squares of one or more of a,b,c exceed the integer bound.
For example, for diff = 8696, low = 945745, high = 2531281, the Python solution finds (947864, 51654240, 51662936) as a valid triple. But the C# version does all the calculations in integers, and so overlooks this (and other triples). If the calculations are done using doubles (as your program wisely does), it finds them. Amazingly, all the people who solved the C# version previously overlooked this as well (so I don't feel so bad :-)).
I believe I have fixed the translations.
Congratulations on discovering this!
yes, you shouldnt make it so returning anything is dependent on if one triplet found is actually invalid. I believe your mistake is in making it return no valid triples based off the fact that one triple had a > b. I would reccomend making it so a!>b is a condition within the statement that checks if for a given value of a, if a is triplet so it doesnt add an invalid ( a>b triplet to the list in the first place). Unless i misunderstand your problem i think that is what needs a fix.
When doing a full attempt, it comes up saying i have extra triples, although these triples are valid, and Im pretty confident my iteration through range of a is working correctly. I saw that the task was somewhat old and that wisdou had issues with c# big numbers before, thought it possible that the testing algorithm had become outdated or something maybe. Can you perhaps look at my code and tell me whether I have just created a faulty program or if the issue is something deeper. Am new to both c# and codewars so could issue be a me issue.
If i return [] everytime first element is not smallest i get another error telling [] should be some not empty list.
Nvm, solved.
a, the first element of the triple, has to be the smallest side. This is not true for 1128, 846, 1410.
what makes you think it's broken?
is this broken?