zoukankan      html  css  js  c++  java
  • 一道算法练习题

    输入一组大于0的整数,删除其中所有重复出现的字,并要求满足如下条件:

    1. 越大的数最终位置尽可能靠前
    2. 优先满足较大的数靠前

    例1
    1, 5, 4, 9, 4, 3, 4, 8, 7, 6, 9, 8, 7, 1

    1, 5, 4, 9, 4, 3, 4, 8, 7, 6, 9, 8, 7, 1

    例2
    8, 4, 7, 6, 4, 9, 7, 9

    8, 4, 7, 6, 4, 9, 7, 9

    实现:

    Code


    代码比较简单,但写出这段代码还是费了点功夫,有兴趣的朋友可以自己练习一下。

  • 相关阅读:
    <s:property>的用法(jsp获取action中的值或者方法)
    struts2 Action获取表单数据
    form标签中id和name属性的区别
    button和submit区别
    hibernate could not resolve property
    Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyExce
    宏定义#define和内联函数inline的区别
    线程绑定cpu
    posix系统线程调度-设置线程优先级
    std::lock_guard和std::unique_lock的区别
  • 原文地址:https://www.cnblogs.com/TianFang/p/1540004.html
Copyright © 2011-2022 走看看