Skip to content

Instantly share code, notes, and snippets.

View mhlangagc's full-sized avatar

Gugulethu mhlangagc

View GitHub Profile
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"
@mhlangagc
mhlangagc / quicksort.swift
Last active April 18, 2016 07:13
Implementation of a quick Sort algorithm in 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)
}