zoukankan      html  css  js  c++  java
  • 2010412 面试题1

    有两个有序整数数组,例如{1,3,5,7,9}和{2,4,6,7,8},设计一个函数使两个数组合并,并且剔除掉两个数组里重复的元素。

    代码
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    namespace ConsoleApplication3
    {
        
    class Program
        {
            
    static void Main(string[] args)
            {
                
    int[] numbers = { 456123-2-10,100 };
                
    int[] numbers2 = { 12223655100 };

                List
    <int> listInt = new List<int>();

                listInt 
    = numbers.Concat(numbers2).OrderBy(f=>f).Distinct().ToList();

                
    foreach (int i in listInt)
                {
                    System.Console.WriteLine(i);
                }
                Console.Read();
            }
        }
    }


  • 相关阅读:
    Java异常处理设计(三)
    TS 3.1
    TS 3.1
    Other
    样式
    Other
    Other
    TS 3.1
    TS 3.1
    TS 3.1
  • 原文地址:https://www.cnblogs.com/mikechang/p/1710501.html
Copyright © 2011-2022 走看看