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  (1879) Save  (1864)
Largest Rectangle in Histogram6.869ms Save  (1929) Save  (1821)
Word Search57.457ms Save  (1857) Save  (1787)
Reverse Words in a String268.937ms Save  (1894) Save  (1812)
Binary Tree Level Order Traversal II5.797ms Save  (1847) Save  (1796)
Binary Tree Level Order Traversal5.631ms Save  (1776) Save  (1859)
Binary Tree Preorder Traversal1.339ms Save  (1811) Save  (1817)
Binary Tree Inorder Traversal1.594ms Save  (1890) Save  (1628)
Binary Tree Postorder Traversal1.694ms Save  (1731) Save  (1708)
Search Insert Position0.002ms Save  (1714) Save  (1660)
Insertion Sort List26.869ms Save  (1673) Save  (1659)
Sort List32.593ms Save  (1691) Save  (1608)
Max Points on a Line3.648ms Save  (1739) Save  (1718)
Evaluate Reverse Polish Notation107.186ms Save  (1731) Save  (1631)