Zulip Chat Archive

Stream: Is there code for X?

Topic: Largest element satisfying P in range


Stuart Presnell (Aug 31 2022 at 10:13):

I know that at least one element in range e satisfies a predicate P. How do I find the largest element in range e satisfying P?

Yaël Dillies (Aug 31 2022 at 10:14):

How do you know there exists a largest one?

Yaël Dillies (Aug 31 2022 at 10:15):

Do you mean docs#finset.range? If so, then use docs#nat.find_greatest.

Junyan Xu (Aug 31 2022 at 16:10):

I would use docs#finset.filter + docs#finset.max'


Last updated: Dec 20 2023 at 11:08 UTC