You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would a pull request be accepted that discusses sub-optimal solutions to the puzzles? For example, the following solution for the Two-Sum Problem is the most concise (and perhaps one of the most obvious) but has O(n^2) complexity:
for x in 0..<array.count {
let currentNumber = array[x]
let numberNeeded = target - currentNumber
if let targetIndex = array.firstIndex(of: numberNeeded) {
return (x, targetIndex)
}
}
The text was updated successfully, but these errors were encountered:
Would a pull request be accepted that discusses sub-optimal solutions to the puzzles? For example, the following solution for the Two-Sum Problem is the most concise (and perhaps one of the most obvious) but has O(n^2) complexity:
The text was updated successfully, but these errors were encountered: