摘要:
static StringCollection Permutations(string input) { if (input == null) { throw new Exception("input can't be null"); } StringCollection results = new StringCollection(); char firstChar = ' '; string rema... 阅读全文
摘要:
public interface IStack<T> { int GetLength(); bool IsEmpty(); bool IsFull(); void Clear(); void Push(T item); T Pop(); T GetTop(); } public class Stack<T> : IStack<T> { private int size; private T[] data; private i... 阅读全文
摘要:
求一个方法,能概率性输出 A 70%, B 20%, C 6%, D 3%, E 1% static char Output() { Random rnd = new Random(); int i = rnd.Next(1, 100); if (i<=70) { return 'A'; } if (i>70 && i<=90) { return 'B';... 阅读全文
摘要:
假设有6个小朋友,编号为1,2,3,4,5,6。 从1数到3,然后把第3个小朋友去除,再从1数到3,把第6个小朋友去除,再从1数到3, 把第4个小朋友去除,求剩下的最后一个小朋友。 static int Func(int[] array, int count) { if (array == null || array.Length== 0 || count <1) { throw new Exception("array or count can't be empty or less than ... 阅读全文