上一页 1 ··· 26 27 28 29 30 31 32 33 34 ··· 37 下一页
摘要: Given a rod of length and prices at which different length of this rod can sell, how do you cut this rod to maximize profit. Solution. Dynamic Program 阅读全文
posted @ 2017-08-18 02:10 Review->Improve 阅读(218) 评论(0) 推荐(0) 编辑
摘要: Given two strings, find longest common substring between them. Solution 1. Brute force search, O(n^2 * m), O(1) memory Algorithm. O(n^2) runtime to fi 阅读全文
posted @ 2017-08-18 01:00 Review->Improve 阅读(275) 评论(0) 推荐(0) 编辑
摘要: Given an array with n distinct elements, convert the given array to a form where all elements are in range from 0 to n-1. The order of elements is sam 阅读全文
posted @ 2017-08-17 06:05 Review->Improve 阅读(362) 评论(0) 推荐(0) 编辑
摘要: Given a sorted array, this array is rotated by some unknown times. Find if there is a pair in this array that sums to a given value. Solution 1. O(n * 阅读全文
posted @ 2017-08-17 05:41 Review->Improve 阅读(334) 评论(0) 推荐(0) 编辑
摘要: Given keys and frequency at which these keys are searched, how would you create a binary search tree from these keys such that the cost of searching i 阅读全文
posted @ 2017-08-16 14:14 Review->Improve 阅读(588) 评论(0) 推荐(0) 编辑
摘要: Write a program to delete a tree. Solution. To delete all tree nodes, we need to set all non-leaf nodes' children nodes to null. So for a given non-le 阅读全文
posted @ 2017-08-16 09:53 Review->Improve 阅读(152) 评论(0) 推荐(0) 编辑
摘要: Write a function to detect if two trees are isomorphic. Two trees are called isomorphic if one of them can be obtained from other by a series of flips 阅读全文
posted @ 2017-08-16 09:42 Review->Improve 阅读(268) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, where every node value is a number . Find the sum of all the numbers which are formed from root to leaf paths. For example consid 阅读全文
posted @ 2017-08-16 03:25 Review->Improve 阅读(210) 评论(0) 推荐(0) 编辑
摘要: Given an array, find the minimum length unsorted subarray. After soring this unsorted subarray, the whole array is sorted. Example, if the input array 阅读全文
posted @ 2017-08-12 13:48 Review->Improve 阅读(190) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers, write a program that cyclically rotates the array by one. Example: given {1,2,3,4,5}, your program should rotate the array 阅读全文
posted @ 2017-08-12 08:01 Review->Improve 阅读(294) 评论(0) 推荐(0) 编辑
上一页 1 ··· 26 27 28 29 30 31 32 33 34 ··· 37 下一页