Ready-to-use Snippets
Curated code snippets across algorithms, data structures, utilities and more. Click any to expand, copy or run in the compiler.
Binary Search
Efficient O(log n) search on a sorted array.
Merge Sort
Divide-and-conquer O(n log n) sort algorithm.
Stack Implementation
LIFO stack with push, pop, peek and isEmpty.
Linked List
Singly linked list with append, prepend, delete & print.
Check Palindrome
Returns true if a string reads the same forwards and backwards.
Anagram Check
Check if two strings are anagrams of each other.
Fibonacci (Memoized)
Fast Fibonacci using memoization cache.
Debounce Function
Delays execution until after N ms of no calls.
Quick Sort
In-place O(n log n) average-case sort.
Queue with deque
Efficient FIFO queue using collections.deque.
Count Word Frequency
Returns a dict of word counts using Counter.
Timing Decorator
Decorator that prints the execution time of any function.
Generic Result Type
Type-safe Result<T, E> pattern for error handling.
Typed Binary Tree
Generic binary search tree with insert and inorder traversal.