原文链接: https://leetcode-cn.com/problems/add-two-numbers 英文原文You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a single digit. Add the two numbers a…
标签详情
递归 分类
原文链接: https://leetcode-cn.com/problems/regular-expression-matching 英文原文Given an input string s and a pattern p, implement regular expression matching with support for '.' and '*' where: '.' Matches any single character. '*' Matches zero or more o…
原文链接: https://leetcode-cn.com/problems/merge-two-sorted-lists 英文原文You are given the heads of two sorted linked lists list1 and list2. Merge the two lists in a one sorted list. The list should be made by splicing together the nodes of the first two li…
原文链接: https://leetcode-cn.com/problems/swap-nodes-in-pairs 英文原文Given a linked list, swap every two adjacent nodes and return its head. You must solve the problem without modifying the values in the list's nodes (i.e., only nodes themselves may be cha…
原文链接: https://leetcode-cn.com/problems/reverse-nodes-in-k-group 英文原文Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. k is a positive integer and is less than or equal to the length of the linked list. …
原文链接: https://leetcode-cn.com/problems/wildcard-matching 英文原文Given an input string (s) and a pattern (p), implement wildcard pattern matching with support for '?' and '*' where: '?' Matches any single character. '*' Matches any sequence of characters…
原文链接: https://leetcode-cn.com/problems/powx-n 英文原文Implement pow(x, n), which calculates x raised to the power n (i.e., xn). Example 1: Input: x = 2.00000, n = 10 Output: 1024.00000 Example 2: Input: x = 2.10000, n = 3 Output: 9.26100 Example 3: Input…
原文链接: https://leetcode-cn.com/problems/reorder-list 英文原文You are given the head of a singly linked-list. The list can be represented as: L0 → L1 → … → Ln - 1 → Ln Reorder the list to be on the following form: L0 → Ln &r…
原文链接: https://leetcode-cn.com/problems/reverse-linked-list 英文原文Given the head of a singly linked list, reverse the list, and return the reversed list. Example 1: Input: head = [1,2,3,4,5] Output: [5,4,3,2,1] Example 2: Input: head = [1,2] Output: [2,…
原文链接: https://leetcode-cn.com/problems/basic-calculator 英文原文Given a string s representing a valid expression, implement a basic calculator to evaluate it, and return the result of the evaluation. Note: You are not allowed to use any built-in function…
原文链接: https://leetcode-cn.com/problems/power-of-two 英文原文Given an integer n, return true if it is a power of two. Otherwise, return false. An integer n is a power of two, if there exists an integer x such that n == 2x. Example 1: Input: n = 1 Output: …
原文链接: https://leetcode-cn.com/problems/number-of-digit-one 英文原文Given an integer n, count the total number of digit 1 appearing in all non-negative integers less than or equal to n. Example 1: Input: n = 13 Output: 6 Example 2: Input: n = 0 Output: 0 …
原文链接: https://leetcode-cn.com/problems/palindrome-linked-list 英文原文Given the head of a singly linked list, return true if it is a palindrome. Example 1: Input: head = [1,2,2,1] Output: true Example 2: Input: head = [1,2] Output: false Constraints: The…
原文链接: https://leetcode-cn.com/problems/different-ways-to-add-parentheses 英文原文Given a string expression of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. You may return…
原文链接: https://leetcode-cn.com/problems/integer-to-english-words 英文原文Convert a non-negative integer num to its English words representation. Example 1: Input: num = 123 Output: "One Hundred Twenty Three" Example 2: Input: num = 12345 Output: "Twelve T…
原文链接: https://leetcode-cn.com/problems/power-of-three 英文原文Given an integer n, return true if it is a power of three. Otherwise, return false. An integer n is a power of three, if there exists an integer x such that n == 3x. Example 1: Input: n = 27 O…
原文链接: https://leetcode-cn.com/problems/power-of-four 英文原文Given an integer n, return true if it is a power of four. Otherwise, return false. An integer n is a power of four, if there exists an integer x such that n == 4x. Example 1: Input: n = 16 Outp…
原文链接: https://leetcode-cn.com/problems/reverse-string 英文原文Write a function that reverses a string. The input string is given as an array of characters s. You must do this by modifying the input array in-place with O(1) extra memory. Example 1: Input:…
原文链接: https://leetcode-cn.com/problems/decode-string 英文原文Given an encoded string, return its decoded string. The encoding rule is: k[encoded_string], where the encoded_string inside the square brackets is being repeated exactly k times. Note that k i…
原文链接: https://leetcode-cn.com/problems/predict-the-winner 英文原文You are given an integer array nums. Two players are playing a game with this array: player 1 and player 2. Player 1 and player 2 take turns, with player 1 starting first. Both players sta…
原文链接: https://leetcode-cn.com/problems/parse-lisp-expression 英文原文You are given a string expression representing a Lisp-like expression to return the integer value of. The syntax for these expressions is given as follows. An expression is either an in…
原文链接: https://leetcode-cn.com/problems/special-binary-string 英文原文Special binary strings are binary strings with the following two properties: The number of 0's is equal to the number of 1's. Every prefix of the binary string has at least as many 1's …
原文链接: https://leetcode-cn.com/problems/basic-calculator-iv 英文原文Given an expression such as expression = "e + 8 - a + 5" and an evaluation map such as {"e": 1} (given in terms of evalvars = ["e"] and evalints = [1]), return a list of tokens representi…
原文链接: https://leetcode-cn.com/problems/k-th-symbol-in-grammar 英文原文We build a table of n rows (1-indexed). We start by writing 0 in the 1st row. Now in every subsequent row, we look at the previous row and replace each occurrence of 0 with 01, and eac…
原文链接: https://leetcode-cn.com/problems/all-possible-full-binary-trees 英文原文Given an integer n, return a list of all possible full binary trees with n nodes. Each node of each tree in the answer must have Node.val == 0. Each element of the answer is th…
原文链接: https://leetcode-cn.com/problems/parsing-a-boolean-expression 英文原文Return the result of evaluating a given boolean expression, represented as a string. An expression can either be: "t", evaluating to True; "f", evaluating to False; "!(expr)", ev…
原文链接: https://leetcode-cn.com/problems/find-kth-bit-in-nth-binary-string 英文原文Given two positive integers n and k, the binary string Sn is formed as follows: S1 = "0" Si = Si-1 + "1" + reverse(invert(Si-1)) for i > 1 Where + denotes the concatenation …
原文链接: https://leetcode-cn.com/problems/count-good-numbers 英文原文A digit string is good if the digits (0-indexed) at even indices are even and the digits at odd indices are prime (2, 3, 5, or 7). For example, "2582" is good because the digits (2 and 8) …
原文链接: https://leetcode-cn.com/problems/minimum-non-zero-product-of-the-array-elements 英文原文You are given a positive integer p. Consider an array nums (1-indexed) that consists of the integers in the inclusive range [1, 2p - 1] in their binary represen…
原文链接: https://leetcode-cn.com/problems/palindrome-linked-list-lcci 英文原文Implement a function to check if a linked list is a palindrome. Example 1: Input: 1->2 Output: false Example 2: Input: 1->2->2->1 Output: true Follow up: Could you do it in O(n) t…
1 / 2