Skip to content

Instantly share code, notes, and snippets.

@Himenon
Created August 8, 2015 03:31
Show Gist options
  • Save Himenon/26befb79d247c6f66b8d to your computer and use it in GitHub Desktop.
Save Himenon/26befb79d247c6f66b8d to your computer and use it in GitHub Desktop.
let ans: [Int] = [1, 0, 1, 1, 1]
var submit: [Int] = [1, 1, 1, 1, 1]
func check(answer: [Int], submit: [Int]) -> Bool {
for i in 0..<answer.count {
if answer[i] != submit[i]{ return false }
}
return true
}
func updateSubmitArray (inout submitArray submit: [Int], #tag: Int, updateValue value: Int) -> [Int] {
if tag > 0 || tag < submit.count {
submit[tag] = value
}
return submit
}
var arr: [Int] = [1, 2, 3]
updateSubmitArray(submitArray: &arr, tag: 2, updateValue: 10)
check(ans, submit)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment