Draft
Square of combination
Loading description...
Fundamentals
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
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.
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.
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
Thank you, this example made it possible to understand the task.
This comment has been hidden.
This comment has been hidden.
Hello... "No digit repetition should be there"
Does this mean that 22 could never be used as one of the numbers because it contains repeated digits. How about 31 + 15 is an invalid combination as the digit '1' is repeated?
Or do you just mean that you cannot take the same number twice i.e. 23 + 23?
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).
This comment has been hidden.
This comment has been hidden.
Unfortunately I cannot read your reply as it is flagged as a spoiler.
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.
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?
Kata has been checked ans edited by the geeks. It is all fine now you can try it
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
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")