Skip to content

Instantly share code, notes, and snippets.

@mcichecki
Created June 23, 2018 10:50

Revisions

  1. mcichecki created this gist Jun 23, 2018.
    7 changes: 7 additions & 0 deletions gcd.swift
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    private func gcd(_ p: Int, _ q: Int) -> Int {
    if q == 0 {
    return p
    }

    return gcd(q, p % q);
    }