Data Structures & Algorithms
237 notes
Some notes are currently available only in Chinese. English translations are shown when available.
- Two Sumhistorical
Given an integer array, find two numbers in the array whose sum equals the target value. The twoSum function should return the indices of these two numbers (index1, index2), with index1 < index2.
- Find All Numbers Disappeared in an Arrayhistorical
An array of length n contains values from 1 to n, some once and some twice. Find the values in this range that do not appear in the array.
- Big Number Additionhistorical
Read two numbers as strings, write a function to calculate their sum, and return the result as a string. (The string length does not exceed 100000, and each string contains only the ten characters '0'~'9'.).
- Subarray Sum Equals Khistorical
Given an integer array and an integer k, find the number of contiguous subarrays whose sum equals k.
- Longest Consecutive Sequencehistorical
Given an unsorted integer array nums, find the length of the longest sequence of consecutive numbers. The elements do not need to be contiguous in the original array.
- Longest Valid Parentheseshistorical
Given a string containing only '(' and ')', find the length of the longest valid (well-formed and consecutive) parentheses substring.
- Remove Invalid Parentheseshistorical
Given a string s containing parentheses and letters, remove the minimum number of invalid parentheses to make the input string valid.
- Generate Parentheseshistorical
The number n represents the number of pairs of parentheses. Design a function that can generate all possible valid combinations of parentheses.
- Valid Parentheseshistorical
Given a string containing only the characters '(', ')', '{', '}', '[' and ']', determine whether the string is a valid parentheses sequence. Parentheses must close in the correct order.