摘要: 给一个随机数字的方法Random,以及数字6,输出随机数列3,5,1,2,4,6.View Code static void Randlist(int n) { if (n<=0) { throw new Exception("Input number must be greater than 0."); } int[] intArr = new int[n]; Random rand = new Random(n); ... 阅读全文
posted @ 2013-03-05 16:29 Ligeance 阅读(377) 评论(0) 推荐(0) 编辑
摘要: 例如,字符串1"abcdefg"就包含有字符串2"cb",因为字符串1中有"bc"子字符串,经过排列后可为"cb"。View Code static bool IsPermutation(string str1, string str2) { if (String.IsNullOrEmpty(str1)||String.IsNullOrEmpty(str2)) { throw new Exception("input can't be empty"); } ... 阅读全文
posted @ 2013-03-05 15:26 Ligeance 阅读(291) 评论(0) 推荐(0) 编辑