Sort 18 Discussions, By:
Please Login in order to post a comment
For N = 9, I got the following result:
sum = 56370
I passed all tests except the last one. Can someone please tell me what's going wrong here?
Got it. No duplicate product. Not no duplicate multiplicand/multiplier pair.
what is the upper limit of the numbers to be considered for multiplicand and multiplier ?
i am getting error for numbers greater than 7 i am using the permutation function.any help will be appericiated
I used the same thing. At the beginning I was also getting wrong answers for TC 1,3 and 5. What kind of error are u getting?
I could pass all the cases with a little modification in pypy3 with the last case taking 1.21s
ive used brute force approach to solve this and got timeout in testcase 5 can anyone explain it
i am getting sum as 0 for n=7. is it correct?
my test case 4 is only failing
no it's not 0 for 7
what we have to add to get the sum becase i am simply breaking the loop .
Could you please tell me what is the logic here?
That's mine :
Generate all pandigital numbers of provided size (I use string permutation to compute them quite fast)
Then split into a/b/c of various sizes and try to find a match in a * b = c
Save c only once in your sum (ex : 4312 and 3412 give 4*3 = 12 and 3*4 = 12. Save 12 only once !)
Let's say i*j=k is pandigital then
i=1 j=2 k=2 (number of digits)
i=1 j=2 k=3
and so on ...
Is there any way other than brute force??
In pandigital generation yes there is better. String permutation ("1234" gives "1234" & "1243" etc.)
please see my test case 5 is failing..
It's because they say "Some products can be obtained in more than one way so be sure to only include it once in your sum."
they mean more than "with the same multiplicand/multiplier"... if you get the same product with different multipliers, that should be excluded as well.