Skip to content

Instantly share code, notes, and snippets.

Gugulethu mhlangagc

  • Johannesburg
View GitHub Profile
mhlangagc / quicksort.swift
Last active Apr 18, 2016
Implementation of a quick Sort algorithm in swift
View quicksort.swift
import UIKit
//Random Interger Generator :: You could alternatively create your own array of Intergers. I prefer a a random way to my array length, minumum and maximum elements.
func randomIntergerInRange(low:Int, high:Int) -> Int {
let randomGeneratedNumber = low + Int(arc4random()) % (high - low);
return Int(randomGeneratedNumber)
View strings.swift
func twoStrings(stringA: String, stringB: String) -> String {
let firstSet = Set(stringA.lowercaseString.characters)
let secondSet = Set(stringB.lowercaseString.characters)
if firstSet.intersect(secondSet).count > 0 {
return "YES"
} else {
return "NO"
You can’t perform that action at this time.