惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Proofpoint News Feed
D
DataBreaches.Net
雷峰网
雷峰网
WordPress大学
WordPress大学
Microsoft Security Blog
Microsoft Security Blog
云风的 BLOG
云风的 BLOG
Google DeepMind News
Google DeepMind News
Blog — PlanetScale
Blog — PlanetScale
MongoDB | Blog
MongoDB | Blog
F
Fortinet All Blogs
B
Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Engineering at Meta
Engineering at Meta
月光博客
月光博客
V
Visual Studio Blog
美团技术团队
I
InfoQ
Stack Overflow Blog
Stack Overflow Blog
Hugging Face - Blog
Hugging Face - Blog
爱范儿
爱范儿
博客园 - 【当耐特】
V
V2EX
Microsoft Azure Blog
Microsoft Azure Blog
博客园 - 聂微东

博客园 - 如斯夫

Windows Azure中的Affinity Group .NET内存管理 .NET程序的运行与内存管理 堆栈和堆 应用程序的装载与运行 字符串匹配算法 – Sunday算法 该怎么教育 COM学习 完成了吗? 技术人员面试流程泳道图 创建型模式 C# 面试题目 单链表中删除重复数据 C# 数据结构 单链表反转 人的问题 foreach中的隐式类型转换 C# 点滴 - 枚举 数据库惊魂 没有人能随随便便成功 If you are a new test manager – From google testing blog
C# 面试算法
如斯夫 · 2010-03-04 · via 博客园 - 如斯夫

从一个数组里选出最大的两个数

        static void PickupMax2(int[] digits)
        {
            if (digits.Length < 2)
            {
                throw new ArgumentOutOfRangeException();
            }

            int max1 = digits[0];
            int max2 = digits[0];

            foreach (int i in digits)
            {
                if (i > max1)
                {
                    max2 = max1;
                    max1 = i;
                }
            }

            Console.WriteLine("max1: {0}, max2: {1}", max1, max2);
        }

posted @ 2010-03-04 16:42  如斯夫  阅读(565)  评论(2)    收藏  举报