1. # LeetCode in Swift: Sort List

Problem Statement Sort a linked list in O(n log n) time using constant space complexity. Original LeetCode problem page My Solution in Swift I used a bottom-up iterative merge-sort to solve this problem with O(n log n) time efficiency and O(1) space efficiency. Note that, you cannot use traditional recursive merge-sort to tackle this problem; Continue reading...

2. # LeetCode in Swift: Max Points on a Line

Problem Statement Given n points on a 2D plane, find the maximum number of points that lie on the same straight line. Original LeetCode problem page My Solution in Swift The basic idea is to calculate gradient of every pair of points, and group points with same gradient. The final answer is then the size Continue reading...

3. # LeetCode in Swift: Evaluate Reverse Polish Notation

Problem Statement Evaluate the value of an arithmetic expression in Reverse Polish Notation. Valid operators are +, -, *, /. Each operand may be an integer or another expression. Some examples:

Original LeetCode problem page My Solution in Swift Continue reading...