@gkucmierz/utils
v1.30.3
Published
Usefull functions for solving programming tasks
Downloads
692
Maintainers
Readme
@gkucmierz/utils
A collection of useful utility functions and data structures for solving algorithmic tasks, competitive programming, and everyday development.
📦 Installation
npm install @gkucmierz/utils🚀 Features
This library provides a wide range of mathematical functions and data structures, including:
Data Structures:
SetCnt: A set-like structure with element counting.Trie: Efficient prefix tree implementation.Heap: Min-heap priority queue.ListNode: Linked list node implementation.matrixAsArray: 2D matrix representation as a flat array.
Number Theory:
gcd,lcm: Greatest Common Divisor and Least Common Multiple (supports BigInt).factors: Prime factorization.phi: Euler's totient function.mod,powMod: Modular arithmetic with Python-like behavior for negative numbers.egcd: Extended Euclidean Algorithm.tonelliShanksBI: Modular square root algorithm.
Sequences & Formulas:
gpn: Generalized Pentagonal Numbers.heronsFormula: Triangle area calculation.squareRoot: Integer square root using Newton's method.
String & Encoding:
base64: Base64 and Base64Url encoding/decoding.copyCase: Match case of a string to another.bijectiveNumeration: Bijective base-k numeration system.
Utilities:
memoize: Function memoization based on arguments.binarySearch: Various binary search implementations (exact, lower bound, upper bound).range2array,array2range: Convert between ranges and arrays.getType: Precise type checking.
📚 Documentation
Full documentation with examples is available at: 👉 https://gkucmierz.github.io/utils
🔗 Links
- NPM Package: https://www.npmjs.com/package/@gkucmierz/utils
- GitHub Repository: https://github.com/gkucmierz/utils
📄 License
MIT
