This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Fibonacci series | |
// F[n] = F[n-1] + F[n-2] | |
// 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144 | |
// Find the fibonacci number for n interations | |
func fibonacci(n: Int) { | |
var num1 = 0 | |
var num2 = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
// MARK: - Comparable | |
extension NSDecimalNumber: Comparable {} | |
public func ==(lhs: NSDecimalNumber, rhs: NSDecimalNumber) -> Bool { | |
return lhs.compare(rhs) == .OrderedSame | |
} |