π Code Examples
π’ Game of life β Contains an implementation of Conwayβs Game of Life cellular automation.
π’ Two sum β Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.
π’ Three sum β Find all unique triplets [a, b, c] in the array such that a + b + c = 0.
π’ Four sum β Find all unique quadrulets [a, b, c, d] in the array such that a + b + c + d = target.
π’ Buy and Sell Stock 1 β Maximize profit by buying once and selling later on a future day.
π’ Buy and Sell Stock 2 β Maximize profit by buying and selling multiple times.
π’ Longest Substring Without Repeating Characters β Given a string s, find the length of the longest substring without duplicate characters.
π’ Product of Array Except Self β Return an array where each element is the product of all others in the input array.
π’ Maximum Subarray β Given an integer array nums, find the subarray with the largest sum, and return its sum.
π’ Maximum Average Subarray β Find the maximum average of any contiguous subarray of length k from the array.
π’ Maximum Product Subarray β Find the maximum product of a contiguous subarray.
π’ Minimum in Rotated Sorted Array β Given a sorted and rotated array, find the minimum element.
π’ Search in Rotated Sorted Array β Find item index in sorted rotated array of items.
π’ Find custom struct index β π Binary Search for Rectangle (a Shape) in a Rotated Sorted List.
π’ Search in Rotated sorted Array 2 β π Search in a rotated sorted array that may contain duplicates.
π’ Convert String to Signed Integer β Implement the atoi(string s) function, which converts a string to a 64-bit signed integer.
π’ Remove Duplicate β Remove duplicates from sorted array.
π’ Merge Sorted Array In Place β A has extra space to hold B. Merge B into A as one sorted array.
π’ Container With Most Water β Given an array of line heights, find the two lines that form the container holding the most water.
π’ Count 1s β Count the number of set bits (Hamming weight) in the binary representation of a positive integer n.
π’ Count 1s For Each Entry β Return an array where each element at index i (0 β€ i β€ n) is the number of 1βs in the binary representation of i.
π’ Generic singnly link list β A singly linked list with parametric polymorphism.
π’ Combination sum β Find all unique combinations of numbers from candidates (reusable unlimited times) that sum to target.
π’ Word Search β Check if a word can be formed in a grid by sequentially adjacent (non-repeating) horizontal or vertical letters.
π’ Longest Common Subsequence Recursive β Return the length of the longest common subsequence between two strings, or 0 if none exists
π’ Longest Common Subsequence Dynamic β Return the length of the longest common subsequence between two strings, or 0 if none exists
π’ Longest Palindromic Substring β Given a string s, return the longest palindromic substring therein
π’ Interleaving String β Determine if s3 is an interleaving of s1 and s2.
π’ Check device core β Check physical and logical cores of the device
π’ SIMD Select β Select based on a SIMD (Single Instruction, Multiple Data) mask
π’ Last word length β Return the length of the last word in a given space-separated string
π’ Largest Number β Arrange non-negative integers to form the largest possible number and return it as a string.
π’ Find All Anagrams in a String β Return all start indices of anagrams of stringβ―pβ―in stringβ―s.
π’ Find First/Last β Find first and last index of a target value in a sorted array
π’ Merge Itervals β Merge overlapping intervals