Draft

Square of combination

Description
Loading description...
Fundamentals
  • Please sign in or sign up to leave a comment.
  • Blind4Basics Avatar

    Worst kata ever (near the head of the run, at least!) How is it that no issues are even opened with this one!??? X/

    • description is BAD, with:
      • words used in a wrong way (digits instead of number, for example)
      • first line is usless and misleading, since it doesn't match the actual task AT ALL
    • return type is BAD
    • task is without interest
    • no random tests
    • no test with duplicates?
    • complete ranges are used only, so why provide a full range list while only the boundaries could be given?

    This is really bad... x(

  • Darshan97 Avatar

    The quality of the description is abysmal.

  • siebenschlaefer Avatar

    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.

    • Mrbhuvaneswaran Avatar

      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

    • siebenschlaefer Avatar

      Thank you, this example made it possible to understand the task.

  • ChristianECooper Avatar

    This comment has been hidden.

  • daddepledge Avatar

    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?

    • Mrbhuvaneswaran Avatar

      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).

    • daddepledge Avatar

      This comment has been hidden.

    • Mrbhuvaneswaran Avatar

      This comment has been hidden.

    • daddepledge Avatar

      Unfortunately I cannot read your reply as it is flagged as a spoiler.

    • daddepledge Avatar

      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.

    • daddepledge Avatar

      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?

    • Mrbhuvaneswaran Avatar

      Kata has been checked ans edited by the geeks. It is all fine now you can try it

    • Mrbhuvaneswaran Avatar

      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

    • daddepledge Avatar

      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")