'unwrap envy' and exceptions

jfondren julian.fondren at gmail.com
Fri Sep 10 13:32:53 UTC 2021


On Friday, 10 September 2021 at 10:17:12 UTC, Timon Gehr wrote:
> On 10.09.21 10:59, Dom DiSc wrote:
>> On Friday, 10 September 2021 at 02:57:37 UTC, jfondren wrote:
>>>     assert(find_gcd([3, 5, 12, 15]) == 3);
>> 
>> Maybe a little off topic, but since when is gcd(3,5) != 1 ??
>> You're program seems to have some bugs...
>
> It's not computing the gcd of the list, just the gcd of its 
> minimum and maximum.

yep, it's a leetcode problem and this min/max requirement is 
probably an arbitrary confounder to make for more interesting 
code than gcd(nums): 
https://leetcode.com/problems/find-greatest-common-divisor-of-array/


More information about the Digitalmars-d mailing list