UInt

struct UInt : FixedWidthInteger, UnsignedInteger
  • Convert UInt to Int

    Declaration

    Swift

    public var toInt: Int
  • Greatest common divisor of two integers using the Euclid’s algorithm. Time complexity of this in O(log(n))

    Declaration

    Swift

    public static func gcd(_ firstNum: UInt, _ secondNum: UInt) -> UInt
  • Least common multiple of two numbers. LCM = n * m / gcd(n, m)

    Declaration

    Swift

    public static func lcm(_ firstNum: UInt, _ secondNum: UInt) -> UInt