Skip to content

Instantly share code, notes, and snippets.

@tianhao-au
Created December 19, 2016 06:22
Show Gist options
  • Save tianhao-au/a804b9fbd8390194b87bf1b08fd710a8 to your computer and use it in GitHub Desktop.
Save tianhao-au/a804b9fbd8390194b87bf1b08fd710a8 to your computer and use it in GitHub Desktop.
def verifyItems(origitems: Array[String], origprices: Array[Float], items: Array[String], prices: Array[Float]): Int = {
val originalPairs = origitems.zip(origprices)
val checkPairs = items.zip(prices)
val results = for {
o <- originalPairs
c <- checkPairs
if o == c
} yield c
results.distinct.length
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment