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  (2006) Save  (2001)
Largest Rectangle in Histogram6.869ms Save  (2068) Save  (1977)
Word Search57.457ms Save  (1988) Save  (1915)
Reverse Words in a String268.937ms Save  (2039) Save  (2037)
Binary Tree Level Order Traversal II5.797ms Save  (1979) Save  (1957)
Binary Tree Level Order Traversal5.631ms Save  (1901) Save  (1987)
Binary Tree Preorder Traversal1.339ms Save  (1927) Save  (1934)
Binary Tree Inorder Traversal1.594ms Save  (2020) Save  (1749)
Binary Tree Postorder Traversal1.694ms Save  (1856) Save  (1825)
Search Insert Position0.002ms Save  (1826) Save  (1772)
Insertion Sort List26.869ms Save  (1803) Save  (1777)
Sort List32.593ms Save  (1814) Save  (1734)
Max Points on a Line3.648ms Save  (1871) Save  (1877)
Evaluate Reverse Polish Notation107.186ms Save  (1849) Save  (1760)