摘要:
static int Sqrt1(int num) { if (num < 0) { throw new Exception(num + " doesn't have square root."); } if (num == 1) { return num; } int low = 0; int high = num; ... 阅读全文
摘要:
static int[] MergeTwoArray(int[] intArr1, int[] intArr2) { if (intArr1 == null || intArr2 == null || intArr1.Length == 0 || intArr2.Length == 0) { throw new Exception("Input cann't be null."); } for (int i = 0; i < intArr1.Len... 阅读全文
摘要:
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ReverseSentence{ class Program { static string ReverseSentence(string str) { if (str == null || str == string.Empty) { throw new Exception("input strin... 阅读全文
摘要:
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace LinkedList{ public interface IListDS<T> { int GetLength(); void Clear(); bool IsEmpty(); void Append(T item); void Insert(T item, int i); T Delete(int i); ... 阅读全文
摘要:
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace SequenceList{ public interface IListDS<T> { int GetLength(); void Clear(); bool IsEmpty(); void Append(T item); void Insert(T item, int i); T Delete(int i); ... 阅读全文
摘要:
View Code static void FindTwoMins(int[] intArr, ref int firstMin, ref int secondMin) { if (intArr == null || intArr.Length <2) { throw new Exception("Input array can't be empty or less than 2"); } if (intArr[0]> intArr[1]) ... 阅读全文
摘要:
static string ReplaceChar(string str, char chr1, char chr2) { if (str == null || str == string.Empty) { throw new Exception("String input can not be null"); } string result = ""; for (int i = 0; i < str.Length; i++)... 阅读全文
摘要:
static string ReverseString(string str) { if (str == null || str.Length <= 1) { return str; } string result = ""; for (int i = str.Length - 1; i >= 0; i--) { result += str[i]; } ... 阅读全文