Skip to content

Instantly share code, notes, and snippets.

@BeauNouvelle
Last active April 4, 2017 13:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BeauNouvelle/4cb7660568c5f2e5a1b195ff9ce71d05 to your computer and use it in GitHub Desktop.
Save BeauNouvelle/4cb7660568c5f2e5a1b195ff9ce71d05 to your computer and use it in GitHub Desktop.
BigInt example with changes.
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