Results for “Arduino / C”
Small, practical examples. Search by task or narrow things down below.
Build text incrementally with StringBuilder
C#: Append fragments instead of repeatedly concatenating intermediate strings in a loop.
C#✓ Tested
Cache repeated pure function calls
Python: Use lru_cache to avoid recomputing results for identical hashable arguments.
Python✓ Tested
Calculate a cumulative integer percentage
SQL: Divide a running window sum by the complete total using a unique ordering key.
SQL✓ Tested
Calculate a cumulative integer percentage
SQL Server: Divide a running window sum by the complete total using a unique ordering key.
SQL Server✓ Tested
Calculate a cumulative integer percentage
Postgres: Divide a running window sum by the complete total using a unique ordering key.
Postgres✓ Tested
Calculate a cumulative integer percentage
SQLite: Divide a running window sum by the complete total using a unique ordering key.
SQLite✓ Tested
Calculate a cumulative sum for each position
C: Keep a running total and store each prefix result in a separate output array.
C✓ Tested
Calculate a file’s SHA-256 digest
PowerShell: Get-FileHash hashes bytes without requiring the caller to load the whole file.
PowerShell✓ Tested
Calculate a fixed-window moving average
C: For this small window, sum each complete group and skip incomplete prefixes.
C✓ Tested
Calculate a least common multiple using a GCD
C: Divide before multiplying to reduce the risk of intermediate overflow.
C✓ Tested
Calculate a lexical relative path
C++: lexically_relative compares path components without requiring the paths to exist.
C++✓ Tested
Calculate a page count with ceiling division
JavaScript: Use Math.ceil for a nonnegative item count and a positive page size.
JavaScript✓ Tested