This file contains 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 Solution { | |
var moves = 0 | |
var rows = 0 | |
var cols = 0 | |
func snakesAndLadders(_ board: [[Int]]) -> Int { | |
let newBoard = convertTo1D(board) | |
print(newBoard) | |
let n = board.count | |
var queue: [Int] = [] | |
var visited: [Bool] = Array(repeating: false, count: n * n) |
This file contains 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
Microsoft Windows [Version 10.0.16299.785] | |
(c) 2017 Microsoft Corporation. All rights reserved. | |
C:\Users\jcourtri>c d/ | |
'c' is not recognized as an internal or external command, | |
operable program or batch file. | |
C:\Users\jcourtri>cd / | |
C:\>D: |
This file contains 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
//: A UIKit based Playground for presenting user interface | |
import UIKit | |
import Foundation | |
import PlaygroundSupport | |
struct Recipe { | |
let name: String | |
} |
This file contains 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
import Foundation | |
/// An abstract class that makes building simple asynchronous operations easy. | |
/// Subclasses must implement `execute()` to perform any work and call | |
/// `finish()` when they are done. All `NSOperation` work will be handled | |
/// automatically. | |
open class AsynchronousOperation: Operation { | |
// MARK: - Properties |
This file contains 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
040e6d66d623e5acc8096514bcba63fe401d945635372ab4c0fdacf7d5634c014012a28826946ada435da2df3b71a0e740369caa378cc08a1838f7b3c9bd271067;aaronpearce |
This file contains 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
//: Playground - noun: a place where people can play | |
import Foundation | |
import UIKit | |
import PlaygroundSupport | |
let buttonTitles = [["shortTitle", "longerTitle", "short"], ["reallyLongTitle", "short", "short"],["short", "short", "short"]] | |
let containerView = UIView(frame: CGRect(x: 0.0, y: 0.0, width: 300.0, height: 300.0)) |
This file contains 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
import Foundation | |
import Result | |
public extension Result { | |
/// Constructs a success wrapping `value`, iff `value` is not nil and `error` is nil. | |
/// | |
/// Constructs a failure wrapping `error`, iff `error` is not nil and `value` is nil. | |
/// | |
/// Otherwise, returns nil. |
This file contains 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
import UIKit | |
import XCPlayground | |
import PlaygroundSupport | |
struct FibonacciIterator: IteratorProtocol { | |
var (first, second) = (0,1) | |
mutating func next() -> Int? { | |
(first, second) = (second, first + second) | |
return first |
This file contains 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
import UIKit | |
import XCPlayground | |
import PlaygroundSupport | |
struct SortedArray<Element: Comparable> { | |
var elements: [Element] | |
init<S: Sequence>(unsorted: S) where S.Iterator.Element == Element { | |
elements = unsorted.sorted() | |
} |
NewerOlder