Results for “as”
Small, practical examples. Search by task or narrow things down below.
Find the first matching value with a fallback
Python: Pass a generator and default to next to avoid building an intermediate list.
Python✓ Tested
Find the first occurrence of a character
C: strchr returns a pointer into the input or NULL if the character is absent.
C✓ Tested
Find the first value satisfying a condition
C++: Compare the returned iterator with end before dereferencing it.
C++✓ Tested
Find the greatest common divisor
Java: BigInteger.gcd calculates an exact nonnegative common divisor.
Java✓ Tested
Find the greatest common divisor with the standard library
C++: std::gcd computes a nonnegative integer common divisor.
C++✓ Tested
Find the index of an array item
PowerShell: Array.IndexOf returns -1 when the requested item is absent.
PowerShell✓ Tested
Find the insertion position for a sorted value
C++: lower_bound returns the first position whose value is not less than the search key.
C++✓ Tested
Find the largest array value
Track the maximum in a nonempty C integer array.
C✓ Tested
Find the largest value
Check for an empty C++ vector before dereferencing max_element.
C++✓ Tested
Find the mean and median of readings
Python: Use statistics helpers to distinguish an arithmetic mean from a middle value.
Python✓ Tested
Find the nearest matching ancestor
Read a parent row attribute using jQuery closest.
jQuery✓ Tested
Find the next chosen weekday
Java: TemporalAdjusters.next excludes the starting day even if it already has that weekday.
Java✓ Tested