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
// | |
// main.swift | |
// MarkovTest | |
// | |
// Created by Peter Kos on 4/20/19. | |
// Copyright © 2019 UW. All rights reserved. | |
// | |
import Foundation |
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
import UIKit | |
let array = [5, 16, 67, 2, 9] | |
// "Manual" way | |
for index in stride(from: 0, to: array.count, by: 2) { | |
print(array[index]) | |
} |
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
// ----------------------------------------- | |
// Playground Code | |
// ----------------------------------------- | |
import UIKit | |
var str = "Hello, playground" | |
// sayHello() prints "hello, person!" |
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
import UIKit | |
// var -- Variable (value can change) | |
// let -- Constant (value cannot change) | |
var str = "Hello, playground" | |
str = "My New String" |
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
.answer { | |
opacity: 1 !important; | |
} | |
.answer_arrow { | |
display: none; | |
} | |
.answer.wrong_answer { | |
border-top: 1px solid #ddd !important; |
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
import static java.lang.System.*; | |
import java.util.ArrayList; | |
public class PCLegitBinaryTree { | |
public static void main(String[] args) { | |
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
import static java.lang.System.*; | |
import java.util.ArrayList; | |
public class PCBTree { | |
public static void main(String[] args) { | |
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
func -= ( left: inout String, right: String) -> String { | |
let index = left.index(left.endIndex, offsetBy: -right.characters.count) | |
return left.substring(to: index) | |
} | |
func *= ( left: inout String, right: String) -> String { | |
var finalString = left | |
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
// Created by @peterkos | |
// Ported from Swift, originally by Apple | |
import java.util.*; | |
public class InheritingInheritance { | |
public static void main(String[] args) { | |
Car car = new Car("red"); | |
RaceCar raceCar = new RaceCar("blue", true); |
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
// My hack | |
ArrayList<Integer> arrayListOfIntegers = new ArrayList<Integer>(); | |
for (char numAsChar : tempArray1AsChar) { | |
if (numAsChar != ' ') { | |
arrayListOfIntegers.add(Character.getNumericValue(numAsChar)); | |
} | |
} | |
// Julian's hack |