Skip to content

Instantly share code, notes, and snippets.

@tsiege
tsiege / The Technical Interview Cheat Sheet.md
Last active November 14, 2024 15:40
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

ANNOUNCEMENT

I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!






\

@kristopherjohnson
kristopherjohnson / executionTimeInterval.swift
Last active May 29, 2024 19:25
Calculate execution time for a block of Swift code
import QuartzCore
func executionTimeInterval(block: () -> ()) -> CFTimeInterval {
let start = CACurrentMediaTime()
block();
let end = CACurrentMediaTime()
return end - start
}
extension Character: Strideable {
public typealias Stride = Int
public func distance(to other: Character) -> Character.Stride {
guard let first = self.unicodeScalars.first else {
fatalError()
}
guard let other = other.unicodeScalars.first else {
fatalError()
}