Skip to content

1.1章节第练习题1.1.29有点问题,就是如果key值大于a中所有元素的值时,应该返回a.length。 #15

@switchplus

Description

@switchplus

public static int rank(int key, int[] a) {
if(key>a[a.length-1])return a.length; //如果key打印a中的每一个元素,则返回a的长度
return rank(key, a, 0, a.length - 1);
}这是修改后的代码

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