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
//#-editable-code | |
// Additional Comments | |
//#-end-editable-code | |
// Contents.swift | |
// Rainbow | |
// | |
// Created by Apollo Zhu (https://github.com/ApolloZhu) on 2016/11/25. | |
// Copyright (c) 2015-2017 WWITDC. All rights reserved. | |
// |
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
// | |
// AZProportionalView.swift | |
// AZProportionalView | |
// | |
// Created by Apollo Zhu on 10/10/16. | |
// Copyright © 2014-2017 WWITDC. All rights reserved. | |
// | |
import UIKit |
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 android.content.Context | |
import android.media.MediaPlayer | |
import android.os.AsyncTask | |
/** | |
* Created by Apollonian on 9/16/17. | |
*/ | |
object Lau { | |
val quotes = arrayOf( | |
R.raw.allright to "Alrigth", |
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
// | |
// ViewController.swift | |
// layout | |
// | |
// Created by Liuliet.Lee on 10/8/2017. | |
// Copyright © 2017 Liuliet.Lee. All rights reserved. | |
// | |
import UIKit | |
class ViewController: UIViewController { |
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
// | |
// AZBiDictionary.swift | |
// Bimap | |
// | |
// Created by Apollo Zhu on 10/26/16. | |
// | |
import Foundation | |
extension Dictionary { |
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
let c={String(repeating:$0,count:$1)};func d(_ n:Int,_ i:Int=0)->String{let b=c(" ",i)+c("*",n)+"\n";return n>1 ?b+d(n-2,i+1)+b:b} | |
print(d(5)) |
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
func A(_ n:Int,_ m:Int)->Int{return m<1 ? 1 : n>m ? (n-m)*A(n-1,m-1)+(m+1)*A(n-1,m) : 0} | |
print("n\tm\tA(n,m)") | |
_ = zip([0,1,1,2,2,2,3,3,3,3,4,4,4,4,4,5,7,9,10,10,10,12,15,17,20,42],[0,0,1,0,1,2,0,1,2,3,0,1,2,3,4,1,4,5,5,7,10,2,6,1,16,42]).map { | |
print("\($0)\t\($1)\t\(A($0,$1))") | |
} |
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
func mergeSorted<T:Comparable>(_ x: [T], _ y: [T], inOrder cmp: (T, T) -> Bool = (<) ) -> [T] { | |
var z = [T]() | |
var i = 0, j = 0 | |
while i < x.count || j < y.count { | |
if j == y.count || cmp(x[i], y[j]) { | |
z.append(x[i]) | |
i += 1 | |
} else { | |
z.append(y[j]) | |
j += 1 |
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 | |
let c={(s:String) in s.utf8.map{String(format:"%02d",$0-96)}.joined()} | |
_ = ["helloworld","codegolf","alphabetcipher","johncena"].map{print(c($0))} | |
print(" ") | |
print("codegolf".utf8.map{String(format:"%02d",$0-96)}.joined()) |
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
(0...103).map{print(String(UnicodeScalar($0/4+65)!))} |
OlderNewer