Data Structures & Algorithms
237 notes
Some notes are currently available only in Chinese. English translations are shown when available.
- Partition Equal Subset Sumhistorical
Given a non-empty array containing only positive integers, determine whether the array can be partitioned into two subsets whose sums are equal.
- Word Breakhistorical
Given a non-empty string s and a list wordDict containing non-empty words, determine whether s can be segmented by spaces into one or more words that appear in the dictionary.
- Perfect Squareshistorical
Given a positive integer n, find several perfect-square numbers (such as 1, 4, 9, 16, ...) whose sum equals n. You need to minimize the number of perfect squares used.
- Word Searchhistorical
Given a two-dimensional grid and a word, determine whether the word exists in the grid.
- Target Sumhistorical
Assign a plus or minus sign to each number in a nonnegative integer array and count the assignments whose sum equals the target S.
- Longest Common Substringhistorical
Given two strings str1 and str2, output their longest common substring. The problem guarantees that the longest common substring of str1 and str2 exists and is unique.
- Combination Sumhistorical
Given an array candidates containing no duplicate elements and a target number target, find all combinations of numbers in candidates whose sum equals target.
- Design an LRU Cachehistorical
Design an LRU cache with a fixed capacity K that supports key lookups and writes, evicting the least recently used entry when capacity is reached.
- Coin Changehistorical
Given coins of different denominations and a total amount, write a function to compute the minimum number of coins needed to make up that amount. If no combination of coins can make up the amount, return -1.
- Longest Common Subsequencehistorical
Given two strings text1 and text2, return the length of their longest common subsequence.