Title: Algorithms - Code Snippets Gallery | Temper Snippets
Open Graph Title: Temper Snippets - Runnable Code Snippets Gallery
X Title: Temper Snippets - Runnable Code Snippets Gallery
Description: Computational solutions with defined complexity
Open Graph Description: Copy, run, and learn from real code examples. Beautiful, runnable snippets for everyday programming tasks.
X Description: Copy, run, and learn from real code examples. Beautiful, runnable snippets for everyday programming tasks.
Keywords:
Opengraph URL: https://tempercode.dev
Domain: tempercode.dev
| theme-color | #0c0d12 |
| color-scheme | dark |
| author | Temper |
| creator | Temper |
| publisher | Temper |
| og:site_name | Temper Snippets |
| og:locale | en_US |
| og:image | https://tempercode.dev/og-image.png |
| og:image:width | 1200 |
| og:image:height | 630 |
| og:image:alt | Temper Snippets - Code Examples Gallery |
| og:type | website |
| twitter:card | summary_large_image |
| twitter:image | https://tempercode.dev/og-image.png |
Links:
| Temper | https://tempercode.dev/snippets |
| Snippets | https://tempercode.dev/snippets |
| Editor | https://tempercode.dev/editor |
| CLI | https://tempercode.dev/cli |
| https://github.com/handcraftbyte/temper-snippets | |
| Snippets | https://tempercode.dev/snippets |
| Editor | https://tempercode.dev/editor |
| CLI | https://tempercode.dev/cli |
| General | https://tempercode.dev/snippets/general |
| Utilities | https://tempercode.dev/snippets/utilities |
| Algorithms | https://tempercode.dev/snippets/algorithms |
| Boilerplates | https://tempercode.dev/snippets/boilerplates |
| Find All DuplicatesFind all elements that appear more than once in an array using frequency counting. | https://tempercode.dev/snippets/find-all-duplicates-javascript |
| Find DuplicateFind the first duplicate element that appears in an array using a hash set for efficient lookup. | https://tempercode.dev/snippets/find-duplicate-javascript |
| Find Missing NumberFind the missing number in a sequence from 1 to n using mathematical sum formula. | https://tempercode.dev/snippets/find-missing-number-javascript |
| Longest Increasing SubsequenceFind the length of the longest increasing subsequence in an array using dynamic programming. | https://tempercode.dev/snippets/longest-increasing-subsequence-javascript |
| Maximum Subarray SumFind the maximum sum of a contiguous subarray using Kadane's algorithm. | https://tempercode.dev/snippets/max-subarray-sum-javascript |
| Merge IntervalsMerge overlapping intervals into consolidated ranges. A classic algorithm problem used in scheduling, genomics, and calendar applications. | https://tempercode.dev/snippets/interval-merge-javascript |
| Sliding Window MaximumFind the maximum value in each sliding window of size k as it moves across the array. | https://tempercode.dev/snippets/sliding-window-max-javascript |
| Spiral MatrixTraverse a 2D matrix in spiral order starting from the top-left corner. | https://tempercode.dev/snippets/spiral-matrix-javascript |
| Three SumFind all unique triplets in an array that sum to a target value. | https://tempercode.dev/snippets/three-sum-javascript |
| Top K ElementsFind the k largest elements in an array using sorting or heap-based approach. | https://tempercode.dev/snippets/top-k-elements-javascript |
| Two SumFind indices of two numbers in an array that add up to a target value using a hash map for O(n) time complexity. | https://tempercode.dev/snippets/two-sum-javascript |
| Mini LLMDemonstrate the core mechanism behind LLMs by predicting the next token, appending it, and repeating. | https://tempercode.dev/snippets/mini-llm-javascript |
| Digital RootCalculate the digital root by repeatedly summing digits until a single digit remains. | https://tempercode.dev/snippets/digital-root-javascript |
| FactorialCalculate the factorial of a number (n!) using iterative multiplication. | https://tempercode.dev/snippets/factorial-javascript |
| Fibonacci SequenceGenerate the first N numbers of the Fibonacci sequence where each number is the sum of the two preceding ones. | https://tempercode.dev/snippets/fibonacci-javascript |
| Greatest Common DivisorFind the greatest common divisor (GCD) of two numbers using the Euclidean algorithm. | https://tempercode.dev/snippets/gcd-javascript |
| Is PrimeCheck if a number is a prime number by testing divisibility up to its square root. | https://tempercode.dev/snippets/is-prime-javascript |
| Least Common MultipleFind the least common multiple (LCM) of two numbers using the GCD-based formula. | https://tempercode.dev/snippets/lcm-javascript |
| Modular ExponentiationCalculate (base^exp) % mod efficiently using binary exponentiation. | https://tempercode.dev/snippets/modular-exponentiation-javascript |
| Nth PrimeFind the nth prime number using primality testing. | https://tempercode.dev/snippets/nth-prime-javascript |
| Prime FactorsFind all prime factors of a number using trial division. | https://tempercode.dev/snippets/prime-factors-javascript |
| Sieve of EratosthenesGenerate all prime numbers up to n using the Sieve of Eratosthenes algorithm. | https://tempercode.dev/snippets/sieve-of-eratosthenes-javascript |
| Binary SearchFind the index of an element in a sorted array using binary search with O(log n) time complexity. | https://tempercode.dev/snippets/binary-search-javascript |
| Bubble SortSort an array using the bubble sort algorithm by repeatedly swapping adjacent elements. | https://tempercode.dev/snippets/bubble-sort-javascript |
| Counting SortSort an array of non-negative integers using counting sort for linear time performance. | https://tempercode.dev/snippets/counting-sort-javascript |
| Heap SortSort an array using the heap sort algorithm with O(n log n) time complexity. | https://tempercode.dev/snippets/heap-sort-javascript |
| Insertion SortSort an array using the insertion sort algorithm by building a sorted portion one element at a time. | https://tempercode.dev/snippets/insertion-sort-javascript |
| Merge SortSort an array using the merge sort algorithm with O(n log n) time complexity. | https://tempercode.dev/snippets/merge-sort-javascript |
| QuicksortSort an array using the quicksort algorithm with average O(n log n) time complexity. | https://tempercode.dev/snippets/quicksort-javascript |
| Selection SortSort an array using the selection sort algorithm by repeatedly finding the minimum element. | https://tempercode.dev/snippets/selection-sort-javascript |
| Check if PalindromeCheck if a string is a palindrome by comparing characters from both ends. | https://tempercode.dev/snippets/is-palindrome-javascript |
| Levenshtein DistanceCalculate the Levenshtein edit distance between two strings using dynamic programming. | https://tempercode.dev/snippets/levenshtein-distance-javascript |
| Longest Common SubstringFind the longest contiguous substring that appears in both strings using an iterative approach. | https://tempercode.dev/snippets/longest-common-substring-javascript |
| String SimilarityCalculate the similarity percentage between two strings based on edit distance. | https://tempercode.dev/snippets/string-similarity-javascript |
| Check Balanced BracketsCheck if brackets in a string are properly balanced and nested using a stack-based approach. | https://tempercode.dev/snippets/balance-brackets-javascript |
Viewport: width=device-width, initial-scale=1