A lightweight, header-only C++ library (mylib.hpp
) providing useful math and string utilities for competitive programming, projects, or everyday coding.
gcd(a, b)
→ Greatest Common Divisorlcm(a, b)
→ Least Common MultipleisPrime(n)
→ Check if a number is primefactors(n)
→ List all factors/divisors of a numbernCr(n, r)
→ Compute combinations (n choose r)
toLower(s)
→ Convert string to lowercasetoUpper(s)
→ Convert string to uppercasesplit(s, delimiter)
→ Split string by a characterjoin(vector<string>, delimiter)
→ Join strings with delimitertrim(s)
→ Remove leading and trailing whitespacereverseWords(s)
→ Reverse order of words in a stringstartsWith(s, prefix)
→ Check if string starts with a prefixendsWith(s, suffix)
→ Check if string ends with a suffix