Last active
April 4, 2017 13:33
-
-
Save BeauNouvelle/4cb7660568c5f2e5a1b195ff9ce71d05 to your computer and use it in GitHub Desktop.
BigInt example with changes.
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
struct BigInt { | |
var value: String | |
func multiply(right: String) -> String { | |
// We'll change this line to use `value` | |
var leftCharacterArray = value.characters.reversed().map { Int(String($0))! } | |
var rightCharacterArray = right.characters.reversed().map { Int(String($0))! } | |
... | |
// Now we can do this | |
let int1 = BigInt(value: "34") | |
let int2 = BigInt(value: "45") | |
let product = int1.multiply(int2.value) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment