摘要: Given an array of positive number, find maximum sum subsequence such that elements in this subsequence are not adjacent to each other. Recursive formu 阅读全文
posted @ 2017-08-22 13:13 Review->Improve 阅读(157) 评论(0) 推荐(0) 编辑
摘要: Find longest bitonic subsequence in given array. Bitonic subsequence first increases then decreases. Same problem link Longest Bitonic Subsequence 阅读全文
posted @ 2017-08-22 12:13 Review->Improve 阅读(146) 评论(0) 推荐(0) 编辑
摘要: Given a staircase and give you can take 1 or 2 steps at a time, how many ways you can reach nth step. Same problem link. Climbing Stairs 阅读全文
posted @ 2017-08-22 12:11 Review->Improve 阅读(105) 评论(0) 推荐(0) 编辑
摘要: Given a 2D immutable array, Write an efficient program to support any given sub-rectangle sum query in this 2D matrix. A simple solution is to add eac 阅读全文
posted @ 2017-08-22 12:08 Review->Improve 阅读(171) 评论(0) 推荐(0) 编辑
摘要: Find Maximum Number that can be formed using all digits in the given integer. Solution 1. O(n * log n) runtime, O(n) space using sorting A simple solu 阅读全文
posted @ 2017-08-22 05:16 Review->Improve 阅读(362) 评论(0) 推荐(0) 编辑
摘要: Given an unsorted array of integers, sort this array using tree sort. 1. Create a binary search tree by inserting array elements. 2. Perform in order 阅读全文
posted @ 2017-08-22 01:44 Review->Improve 阅读(228) 评论(0) 推荐(0) 编辑
摘要: Given Inorder and Preorder traversals of a binary tree, print Postorder traversal. Example: A naive solution is to first construct the given tree, the 阅读全文
posted @ 2017-08-22 00:59 Review->Improve 阅读(322) 评论(0) 推荐(0) 编辑