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.
importFoundation;// Enter your code here varaliceArray=readLine()!.components(separatedBy:" ").map{Int($0)!}varbobArray=readLine()!.components(separatedBy:" ").map{Int($0)!}varalicePoints=0varbobPoints=0varcounter=0for_inaliceArray{ifaliceArray[counter]>bobArray[counter]{alicePoints+=1}elseifbobArray[counter]>aliceArray[counter]{bobPoints+=1}counter+=1}print("\(alicePoints)"+" "+"\(bobPoints)")
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 a simple Swift solution: