Results for “min”
Small, practical examples. Search by task or narrow things down below.
Build a minimum-priority queue
C++: Supply greater as the comparator because priority_queue defaults to the largest value first.
C++✓ Tested
Check a deterministic result with an assertion
Check a deterministic result with an assertion in a complete Rust program using the standard library.
Rust✓ Tested
Check positive integer addition before performing it
C: Check the upper boundary before adding two known nonnegative integers.
C✓ Tested
Convert a duration to hours and minutes
Python: Use divmod to split nonnegative whole seconds into display components.
Python✓ Tested
Copy a string with a guaranteed terminator
Arduino / C: Reserve one character for the terminator when copying a bounded string.
Arduino / C✓ Tested
Count newline-terminated records
Linux Commands: Count newline-terminated records using GNU/Linux commands in an empty practice directory.
Linux Commands✓ Tested
Determine whether a year is a leap year
Python: Use calendar.isleap rather than a simplified divisibility-by-four check.
Python✓ Tested
Enforce a minimum width
CSS: Min-width can prevent a declared smaller width from taking effect.
CSS✓ Tested
Enhance a layout above a minimum viewport width
CSS: A mobile-first min-width query adds columns when enough horizontal space is available.
CSS✓ Tested
Format a bounded duration as hours minutes and seconds
PowerShell: TimeSpan can format duration components with escaped separators.
PowerShell✓ Tested
Format whole seconds as hours minutes and seconds
JavaScript: Use integer divisions and remainders for a nonnegative duration.
JavaScript✓ Tested
Format whole seconds as hours minutes and seconds
TypeScript: Use integer divisions and remainders for a nonnegative duration.
TypeScript✓ Tested