You are viewing a single comment's thread. Return to all comments →
def solve(y): V = 0 n = len(y) result = [] for num in y: count = sum(1 for other_num in y if other_num >= num) result.append(count) [V += (n+1)/ (result[i]+1) for i in range(n)] return ["%.2f" % V]
Hey. Any chance you could explain your solution? Specifically why the second last line works?
Seems like cookies are disabled on this browser, please enable them to open this website
I agree to HackerRank's Terms of Service and Privacy Policy.
Vertical Sticks
You are viewing a single comment's thread. Return to all comments →
Hey. Any chance you could explain your solution? Specifically why the second last line works?