Skip to content

题目46的代码有缺陷 #3

Description

@Zany9527

如果列表前置位有多个元素不断重复相互覆盖次数,导致这些元素对于结果没有影响,那么后续的判断中相当于减小了列表的长度,后置位中的新元素只要出现次数多于减小后列表的50%,就会被作为最终结果输出,但是这种情况下的结果明显是不合题意的。
比如输入[0, 1, 0, 1, 2, 2, 3],输出结果为2
(没学多久,说错了请见谅😂)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions