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'm not sure whether the for in a sequence comprehension is really considered to be the same as a for-loop, but I thought I'd try to make a solution without that keyword anyway.
Yesterday, I had submitted this longer answer because I was sleepy…
def compareTriplets(a, b):
at = bt = 0
for i in range(3):
if a[i] > b[i]:
at += 1
if b[i] > a[i]:
bt += 1
return [at, bt]
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Compare the Triplets
You are viewing a single comment's thread. Return to all comments →
Here's my shortest answer (so far)…
Also short, but done without
for
loop…I'm not sure whether the
for
in a sequence comprehension is really considered to be the same as afor
-loop, but I thought I'd try to make a solution without that keyword anyway.Yesterday, I had submitted this longer answer because I was sleepy…