首页
Python
Java
前端
数据库
Linux
Chatgpt专题
开发者工具箱
celebrity专题
LeetCode 题解(263) : Find the Celebrity
题目: Suppose you are at a party with n people (labeled from 0 to n - 1) and among them, there may exist one celebrity. The definition of a celebrity is that all the other n - 1 people know him/her b
阅读更多...
Find Celebrity II
给你一个set<object> 然后给你了个compareTo的方法,可以比较出大小(任意两个objects都能比较出大小,但是这种关系不具有传递性,即A>B,B>C但是A不一定大于C),让你找出set中最大的object,如果不存在,就返回null。int compare(Object o1, Object o2) {return o1.toString().compareTo(o2.toStr
阅读更多...