摘要: Given an expression remove the unnecessary brackets in it without creating an ambiguity in its execution.input outputex1: (a+(b)+c) => a+b+cex2: (a*b)+c => a*b+c 阅读全文
posted @ 2011-12-19 22:28 百分百好牛 阅读(259) 评论(0) 推荐(0) 编辑
摘要: Given an array of size n, find all the possible sub set of the array of size k(all the subsets must be of size k).Q:给一个大小为n的数组,输出其中k个数字的组合。A:void subarray(int arr[], int t[], int n, int index, int k, int kIndex) { int i; if (n == 0) return; if (kIndex == k) { // 说明已经取到了k个数字,打印出来 ... 阅读全文
posted @ 2011-12-19 14:16 百分百好牛 阅读(325) 评论(0) 推荐(0) 编辑