# Project Euler #62: Cubic permutations

# Project Euler #62: Cubic permutations

rsharipov + 1 comment Hi, How can there be several sets of numbers if we are asked to print the smallest cube with the property? How can there be several smallest numbers?

Thanks

Alexander125 + 0 comments This not good explanation of the problem. Spent couple hours to understand. Smallest in this case means smallest from set, Like for example set {1, 3, 5}, you need print only 1. But you can have several sets which staisfy to problem conditions.

Piyushgrwl + 0 comments Hi, can anyone please give more testcases with max valus of N and K? I am failing test-cases from #5 to #9.

coder_batman + 1 comment please suggest improvements.....can only pass 0 and 1st cases

i=0; cubes=[] n,k=map(int,input().split(' ',1)) while(1): cube=sorted(list(str(i**3))) cubes.append(cube) if(cubes.count(cube)==k): print(pow(cubes.index(cube),3)) break i=i+1

tushartyagi8750 + 0 comments my logic is almost same as yours and i am able to pass first 3 test cases only. can anyone give a hint.

jchinte + 2 comments Hi,

I'm passing tests 0,1,2, and 9, and i'm failing the rest. I'm guessing that test #9 is the one where N and K are the max.

Any hints? Can a valid permutation include 0's?

shashank21jHackerRank AdminChallenge Author + 2 comments It can't have 0's

jchinte + 1 comment so all permutations have to have the same number of digits then.

"Sorted order" means ascending order?

shashank21jHackerRank AdminChallenge Author + 1 comment Correct ! :)

jchinte + 0 comments AH! I wrongly assumed my results list was already sorted as it was being created!

Akul_Swamy + 1 comment What do you mean by "It can't have 0's" ? Your sample test case contains a 0.

Sirac + 0 comments I guess they mean a leading zero. If I understood correctly, 604 is a valid permutation of 406, but 046 is not. that is what they mean by "the same number of digits"

stbrumme + 1 comment Valid permutation can have zeros, but no leading zeros.

Initially, I had the same problem like you and passed only #0,#1,#2 and #9. Then I discovered that I printed the correct numbers in the wrong order ... they must be sorted ascendingly.

khoangcachxalam1 + 0 comments :) , one first ! I had the same problem like you and passed only #0,#1,#2 and #9 ! then , i using more funtion sort(result) and earn full test , thanks for your good idea :)

No more comments

Sort 4 Discussions, By:

Please Login in order to post a comment