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.
Worst kata ever (near the head of the run, at least!) How is it that no issues are even opened with this one!??? X/
This is really bad... x(
The quality of the description is abysmal.
Thank you, this example made it possible to understand the task.
Believe it or not, I like the Kata. You should change the description so that it makes sense. The terms digit and combination have specific meanings and were not used correctly. I suggest this description:
An array of numbers and a target element is given. Write a function that finds all possible permutations of two numbers in the given array that sum to the target. Combine the digits of each pair of two numbers to make a single number. Sum these. Take the modulus of this sum with 50, return "True" if this a perfect square,false otherwise.
Example
Input: arr = [1,2,3] target = 4
Now the possible 2 number permutations are 13 and 31. Since 1+3 = 4 and 3+1= 4. No number repetition is allowed, so we do not see 2+2.. Calculate sum of the combinations 13+31 = 44 and calculate the mod 50 of the sum return 'True' if the value is a perfect square and 'False' otherwise.
Also the third test in the examples should be
Test.assert_equals(combinations(list(range(30)),41),"False")
arr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]
target: 41
pairs: [(12, 29), (13, 28), (14, 27), (15, 26), (16, 25), (17, 24), (18, 23), (19, 22), (20, 21), (21, 20), (22, 19), (23, 18), (24, 17), (25, 16), (26, 15), (27, 14), (28, 13), (29, 12)]
as ints: [1229, 1328, 1427, 1526, 1625, 1724, 1823, 1922, 2021, 2120, 2219, 2318, 2417, 2516, 2615, 2714, 2813, 2912]
sum: 37269
sum % 50: 19
result: False
Explained by ChristianEcooper
this goes inside the program
Kata has been checked ans edited by the geeks. It is all fine now you can try it
Ok, I pass the example tests including one that has a target of 41 using [0,1,...,29]. Get expected result 'True'
The same test on the Attempt expects 'False'
Any idea what is going on?
I have got further, past the example tests. But am still unsure what the instructions mean.
When you say "possible 2 digit combinations" do you mean 2 number combinations?
0,1,2,3,4,5,6,7,8,9 are THE digits.
23 is not a digit. It is a number comprising two digits.
Unfortunately I cannot read your reply as it is flagged as a spoiler.
arr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]
target: 41
pairs: [(12, 29), (13, 28), (14, 27), (15, 26), (16, 25), (17, 24), (18, 23), (19, 22), (20, 21), (21, 20), (22, 19), (23, 18), (24, 17), (25, 16), (26, 15), (27, 14), (28, 13), (29, 12)]
as ints: [1229, 1328, 1427, 1526, 1625, 1724, 1823, 1922, 2021, 2120, 2219, 2318, 2417, 2516, 2615, 2714, 2813, 2912]
sum: 37269
sum % 50: 19
result: False
Explained by ChristianEcooper
This comment is hidden because it contains spoiler information about the solution
I do not understand the task. Seriously, I tried.
I couldn't even understand some single sentences, but that might be my fault because I'm not a native English speaker.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
22 is not possible since 2 is a digit that is repeated. But 13 and 31 are valid numbers, because there is no digit repeated in 13 (1 and 3 is unique) and 31( 3 and 1 is unique).
Loading more items...