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  (1969) Save  (1968)
Largest Rectangle in Histogram6.869ms Save  (2029) Save  (1940)
Word Search57.457ms Save  (1958) Save  (1882)
Reverse Words in a String268.937ms Save  (1999) Save  (1982)
Binary Tree Level Order Traversal II5.797ms Save  (1945) Save  (1900)
Binary Tree Level Order Traversal5.631ms Save  (1864) Save  (1956)
Binary Tree Preorder Traversal1.339ms Save  (1898) Save  (1901)
Binary Tree Inorder Traversal1.594ms Save  (1989) Save  (1717)
Binary Tree Postorder Traversal1.694ms Save  (1823) Save  (1790)
Search Insert Position0.002ms Save  (1806) Save  (1748)
Insertion Sort List26.869ms Save  (1769) Save  (1747)
Sort List32.593ms Save  (1783) Save  (1701)
Max Points on a Line3.648ms Save  (1841) Save  (1823)
Evaluate Reverse Polish Notation107.186ms Save  (1819) Save  (1724)