Skip to content

I have a better way to solve exercise 89 #217

@anthonyduong9

Description

@anthonyduong9

I think

print(np.sort(Z)[-n:])

or

Z.sort()
print(Z[-n:])

would be better than

print (Z[np.argsort(Z)[-n:]])

because the first solution is simpler, and if it's ok to modify the array in place, the second solution is faster and uses less space.

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