原文链接: https://leetcode-cn.com/problems/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. You may assume that each input would have exactly one solution, and you may n…
标签详情
哈希表 分类
原文链接: https://leetcode-cn.com/problems/longest-substring-without-repeating-characters 英文原文Given a string s, find the length of the longest substring without repeating characters. Example 1: Input: s = "abcabcbb" Output: 3 Explanation: The answer is "…
原文链接: https://leetcode-cn.com/problems/integer-to-roman 英文原文Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. Symbol Value I 1 V 5 X 10 L 50 C 100 D 500 M 1000 For example, 2 is written as II in Roman numeral, just tw…
原文链接: https://leetcode-cn.com/problems/roman-to-integer 英文原文Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. Symbol Value I 1 V 5 X 10 L 50 C 100 D 500 M 1000 For example, 2 is written as II in Roman numeral, just tw…
原文链接: https://leetcode-cn.com/problems/letter-combinations-of-a-phone-number 英文原文Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent. Return the answer in any order. A mapping o…
原文链接: https://leetcode-cn.com/problems/substring-with-concatenation-of-all-words 英文原文You are given a string s and an array of strings words of the same length. Return all starting indices of substring(s) in s that is a concatenation of each word in w…
原文链接: https://leetcode-cn.com/problems/valid-sudoku 英文原文Determine if a 9 x 9 Sudoku board is valid. Only the filled cells need to be validated according to the following rules: Each row must contain the digits 1-9 without repetition. Each column must…
原文链接: https://leetcode-cn.com/problems/first-missing-positive 英文原文Given an unsorted integer array nums, return the smallest missing positive integer. You must implement an algorithm that runs in O(n) time and uses constant extra space. Example 1: Inp…
原文链接: https://leetcode-cn.com/problems/set-matrix-zeroes 英文原文Given an m x n integer matrix matrix, if an element is 0, set its entire row and column to 0's, and return the matrix. You must do it in place. Example 1: Input: matrix = [[1,1,1],[1,0,1],[…
原文链接: https://leetcode-cn.com/problems/minimum-window-substring 英文原文Given two strings s and t of lengths m and n respectively, return the minimum window substring of s such that every character in t (including duplicates) is included in the window. I…
原文链接: https://leetcode-cn.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal 英文原文Given two integer arrays preorder and inorder where preorder is the preorder traversal of a binary tree and inorder is the inorder traversal of the s…
原文链接: https://leetcode-cn.com/problems/construct-binary-tree-from-inorder-and-postorder-traversal 英文原文Given two integer arrays inorder and postorder where inorder is the inorder traversal of a binary tree and postorder is the postorder traversal of t…
原文链接: https://leetcode-cn.com/problems/word-ladder-ii 英文原文A transformation sequence from word beginWord to word endWord using a dictionary wordList is a sequence of words beginWord -> s1 -> s2 -> ... -> sk such that: Every adjacent pair of words diff…
原文链接: https://leetcode-cn.com/problems/word-ladder 英文原文A transformation sequence from word beginWord to word endWord using a dictionary wordList is a sequence of words beginWord -> s1 -> s2 -> ... -> sk such that: Every adjacent pair of words differs…
原文链接: https://leetcode-cn.com/problems/longest-consecutive-sequence 英文原文Given an unsorted array of integers nums, return the length of the longest consecutive elements sequence. You must write an algorithm that runs in O(n) time. Example 1: Input: nu…
原文链接: https://leetcode-cn.com/problems/clone-graph 英文原文Given a reference of a node in a connected undirected graph. Return a deep copy (clone) of the graph. Each node in the graph contains a value (int) and a list (List[Node]) of its neighbors. class…
原文链接: https://leetcode-cn.com/problems/copy-list-with-random-pointer 英文原文A linked list of length n is given such that each node contains an additional random pointer, which could point to any node in the list, or null. Construct a deep copy of the li…
原文链接: https://leetcode-cn.com/problems/word-break 英文原文Given a string s and a dictionary of strings wordDict, return true if s can be segmented into a space-separated sequence of one or more dictionary words. Note that the same word in the dictionary …
原文链接: https://leetcode-cn.com/problems/word-break-ii 英文原文Given a string s and a dictionary of strings wordDict, add spaces in s to construct a sentence where each word is a valid dictionary word. Return all such possible sentences in any order. Note …
原文链接: https://leetcode-cn.com/problems/linked-list-cycle 英文原文Given head, the head of a linked list, determine if the linked list has a cycle in it. There is a cycle in a linked list if there is some node in the list that can be reached again by conti…
原文链接: https://leetcode-cn.com/problems/linked-list-cycle-ii 英文原文Given the head of a linked list, return the node where the cycle begins. If there is no cycle, return null. There is a cycle in a linked list if there is some node in the list that can b…
原文链接: https://leetcode-cn.com/problems/lru-cache 英文原文Design a data structure that follows the constraints of a Least Recently Used (LRU) cache. Implement the LRUCache class: LRUCache(int capacity) Initialize the LRU cache with positive size capacity.…
原文链接: https://leetcode-cn.com/problems/max-points-on-a-line 英文原文Given an array of points where points[i] = [xi, yi] represents a point on the X-Y plane, return the maximum number of points that lie on the same straight line. Example 1: Input: points …
原文链接: https://leetcode-cn.com/problems/intersection-of-two-linked-lists 英文原文Given the heads of two singly linked-lists headA and headB, return the node at which the two lists intersect. If the two linked lists have no intersection at all, return null…
原文链接: https://leetcode-cn.com/problems/fraction-to-recurring-decimal 英文原文Given two integers representing the numerator and denominator of a fraction, return the fraction in string format. If the fractional part is repeating, enclose the repeating par…
原文链接: https://leetcode-cn.com/problems/majority-element 英文原文Given an array nums of size n, return the majority element. The majority element is the element that appears more than ⌊n / 2⌋ times. You may assume that the majority element a…
原文链接: https://leetcode-cn.com/problems/repeated-dna-sequences 英文原文The DNA sequence is composed of a series of nucleotides abbreviated as 'A', 'C', 'G', and 'T'. For example, "ACGAATTCCG" is a DNA sequence. When studying DNA, it is useful to identify …
原文链接: https://leetcode-cn.com/problems/happy-number 英文原文Write an algorithm to determine if a number n is happy. A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squa…
原文链接: https://leetcode-cn.com/problems/isomorphic-strings 英文原文Given two strings s and t, determine if they are isomorphic. Two strings s and t are isomorphic if the characters in s can be replaced to get t. All occurrences of a character must be repl…
原文链接: https://leetcode-cn.com/problems/implement-trie-prefix-tree 英文原文A trie (pronounced as "try") or prefix tree is a tree data structure used to efficiently store and retrieve keys in a dataset of strings. There are various applications of this dat…
1 / 11