Apple-Swift

I am a big fan of Apple Swift programming language. Here are some works I have done with it so far. Hope you can find them some how useful to you. Please do leave comments

LeetCode in Swift

1: each links to a blog post of mine that is dedicated to the problem
2: total execution time of a solution on my MacBook Pro (Late 2013, 2.6 GHz Intel Core i7, 16 GB 1600 MHz DDR3). Each solution is compiled with following command:

$ swiftc -O -sdk `xcrun --show-sdk-path --sdk macosx` json.swift main.swift -o mySolution

The total execution time is the average of 10 runs.
3: these test cases are semi-automatically :P retrieved from LeetCode Online Judge system and are kept in JSON format
4: each Xcode project includes everything (my Swift solution to a problem, its JSON test cases and a driver code to test the solution on those test cases)

Problem1Time2Test Cases3My Xcode Project4
Longest Palindromic Substring2.413ms Save  (1997) Save  (1989)
Largest Rectangle in Histogram6.869ms Save  (2059) Save  (1968)
Word Search57.457ms Save  (1982) Save  (1907)
Reverse Words in a String268.937ms Save  (2028) Save  (2015)
Binary Tree Level Order Traversal II5.797ms Save  (1971) Save  (1948)
Binary Tree Level Order Traversal5.631ms Save  (1892) Save  (1978)
Binary Tree Preorder Traversal1.339ms Save  (1918) Save  (1925)
Binary Tree Inorder Traversal1.594ms Save  (2009) Save  (1741)
Binary Tree Postorder Traversal1.694ms Save  (1845) Save  (1815)
Search Insert Position0.002ms Save  (1821) Save  (1766)
Insertion Sort List26.869ms Save  (1794) Save  (1768)
Sort List32.593ms Save  (1808) Save  (1726)
Max Points on a Line3.648ms Save  (1864) Save  (1867)
Evaluate Reverse Polish Notation107.186ms Save  (1842) Save  (1751)