static未央

博客园 首页 新随笔 联系 订阅 管理

2011年5月26日 #

摘要: usingSystem;usingSystem.Collections.Generic;namespaceReverWords{classMainClass{publicstaticvoidMain(string[]args){Console.WriteLine(ReverseWords("HelloWorld"));Console.Read();}publicstaticstringReverseWords(stringarray){if(string.IsNullOrEmpty(array)){thrownewArgumentException("" 阅读全文
posted @ 2011-05-26 22:49 abstract未央 阅读(482) 评论(0) 推荐(0)

摘要: 中软面试第二轮,被推到微软面试,这个题目:/* 输入:两个有序数组 * 输入:合并后的排序数组 */ 当时一片空白了。我写了一个,人家说效率低下,事后写的方法,以防忘记 // 将小的值加到result,并将该数组下标+1, // 如果相等,则将其任意一个加到result,两数组下标均+1 // 如果下标超出该数组长度,则退出循环 staticList<int>MergeArray(int[]a,int[]b){intidxa=0;intidxb=0;List<int>result=newList<int>();while(true){if(idxa>a 阅读全文
posted @ 2011-05-26 18:15 abstract未央 阅读(368) 评论(0) 推荐(0)