SWIFT: whole minute dilemma - Swift solution - COFPROG

SWIFT: whole minute dilemma - Swift solution

    


SWIFT: whole minute dilemma - Swift solution  

func playlist(songs: [Int]) -> Int {

    var count = 0

    for i in 0..<songs.count {

        for j in (i+1)..<songs.count {

            if ((songs[i] + songs[j]) % 60 == 0) {

                count += 1

            }

        }

    }


    return count

}

SWIFT: whole minute dilemma - Swift solution
whole minute dilemma


Previous
Next Post »