摘要: Given an unsorted array arr[0..n-1] of size n, find the minimum length subarray arr[s..e] such that sorting this subarray makes the whole array sorted... 阅读全文
posted @ 2016-01-25 12:08 Hygeia 阅读(234) 评论(0) 推荐(0) 编辑
摘要: /* Write a function to compute the maximum length palindromic sub-sequence of an array. A palindrome is a sequence which is equal to its reverse. A su... 阅读全文
posted @ 2016-01-25 05:14 Hygeia 阅读(159) 评论(0) 推荐(0) 编辑
摘要: public static String FindAndReplace(String GivenString, String Pattern, String ReplaceString) { int j = 0; int tempi; ... 阅读全文
posted @ 2016-01-25 03:17 Hygeia 阅读(171) 评论(0) 推荐(0) 编辑
摘要: 设计一个generic class,要求支持add(T), remove(T), randomRemove(T)三个操作,并且必须保证都是O(1)。比如说add(cat), add(dog), add(pig), add(cat), remove(cat), remove(dog)等等,她还特意说必... 阅读全文
posted @ 2016-01-25 01:39 Hygeia 阅读(612) 评论(0) 推荐(0) 编辑
摘要: Question: How do you shuffle an array in place?伪代码如下:To shuffle an array a of n elements (indices 0..n-1): for i from n − 1 downto 1 do j ← ran... 阅读全文
posted @ 2016-01-25 01:34 Hygeia 阅读(240) 评论(0) 推荐(0) 编辑