This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Check If a string has all unique characters, without using additional data structure. | |
func isUnique(string: String) -> Bool { | |
// what type of characters // if ascii characters | |
if string.characters.count > 128 { | |
return true | |
} | |
var cIdx = 0 | |
for c in string.characters { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol QueueType { | |
typealias Element | |
mutating func enqueue(element: Element) | |
mutating func dequeue() -> Element? | |
func peek() -> Element? | |
} | |
final class Storage<Element> { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A { | |
var x = "a" | |
} | |
var a: A = A() | |
isUniquelyReferencedNonObjC(&a) | |
var b = a | |
isUniquelyReferencedNonObjC(&a) |
NewerOlder