Ready-to-use Snippets

Curated code snippets across algorithms, data structures, utilities and more. Click any to expand, copy or run in the compiler.

Language
Category
14 snippets
JSAlgorithms

Binary Search

Efficient O(log n) search on a sorted array.

JSSorting

Merge Sort

Divide-and-conquer O(n log n) sort algorithm.

JSData Structures

Stack Implementation

LIFO stack with push, pop, peek and isEmpty.

JSData Structures

Linked List

Singly linked list with append, prepend, delete & print.

JSStrings

Check Palindrome

Returns true if a string reads the same forwards and backwards.

JSStrings

Anagram Check

Check if two strings are anagrams of each other.

JSAlgorithms

Fibonacci (Memoized)

Fast Fibonacci using memoization cache.

JSUtilities

Debounce Function

Delays execution until after N ms of no calls.

PYAlgorithms

Quick Sort

In-place O(n log n) average-case sort.

PYData Structures

Queue with deque

Efficient FIFO queue using collections.deque.

PYStrings

Count Word Frequency

Returns a dict of word counts using Counter.

PYUtilities

Timing Decorator

Decorator that prints the execution time of any function.

TSUtilities

Generic Result Type

Type-safe Result<T, E> pattern for error handling.

TSData Structures

Typed Binary Tree

Generic binary search tree with insert and inorder traversal.