We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I've solved the psuedocode , but the thing is I am not able to find the solution if the loop never ends {i.e., -1 . Its a bit tricky}.
If any one can find the solution please do reply back.
def iterateIt(a):
emp = []
rep = 0
while True:
b = []
for x in a:
for y in a:
if x != y:
temp = abs(x-y)
b.append(temp)
a = b
rep = rep + 1
if a == emp:
return rep
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Iterate It
You are viewing a single comment's thread. Return to all comments →
I've solved the psuedocode , but the thing is I am not able to find the solution if the loop never ends {i.e., -1 . Its a bit tricky}.
If any one can find the solution please do reply back.