Sort 19 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.
ive used brute force approach to solve this and got timeout in testcase 5 can anyone explain it
what is the upper limit of the numbers to be considered for multiplicand and multiplier ?
passed all the test cases
for i in range(1964,1,-1):
for j in range(100):
if j not in set1:
if value not in set1 :
matcher=''.join(str(k) for k in range(1,n+1))
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
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.)