Category: algorithms
Simplify an absolute path for a file (Unix-style): For example, path = "/home/", => "/home" path = "/a/./b/../../c/", => "/c" Did you consider the case where path = “/../”? …
Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, …
Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array , the contiguous subarray has the largest …
Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. Assume that …
We have talked about the Pre-order in this post, and In-order Traversal for binary tree in this post. And this article talks about the third kind: Postorder traversal, which …