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  (554) Save  (506)
Largest Rectangle in Histogram6.869ms Save  (484) Save  (473)
Word Search57.457ms Save  (506) Save  (434)
Reverse Words in a String268.937ms Save  (483) Save  (425)
Binary Tree Level Order Traversal II5.797ms Save  (504) Save  (489)
Binary Tree Level Order Traversal5.631ms Save  (475) Save  (537)
Binary Tree Preorder Traversal1.339ms Save  (494) Save  (489)
Binary Tree Inorder Traversal1.594ms Save  (466) Save  (465)
Binary Tree Postorder Traversal1.694ms Save  (440) Save  (447)
Search Insert Position0.002ms Save  (457) Save  (447)
Insertion Sort List26.869ms Save  (439) Save  (398)
Sort List32.593ms Save  (417) Save  (463)
Max Points on a Line3.648ms Save  (455) Save  (463)
Evaluate Reverse Polish Notation107.186ms Save  (423) Save  (433)