原文链接: https://leetcode-cn.com/problems/multiply-strings 英文原文Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2, also represented as a string. Note: You must not use any built-in BigInteger librar…
标签详情
模拟 分类
原文链接: https://leetcode-cn.com/problems/spiral-matrix 英文原文Given an m x n matrix, return all elements of the matrix in spiral order. Example 1: Input: matrix = [[1,2,3],[4,5,6],[7,8,9]] Output: [1,2,3,6,9,8,7,4,5] Example 2: Input: matrix = [[1,2,3,4],…
原文链接: https://leetcode-cn.com/problems/spiral-matrix-ii 英文原文Given a positive integer n, generate an n x n matrix filled with elements from 1 to n2 in spiral order. Example 1: Input: n = 3 Output: [[1,2,3],[8,9,4],[7,6,5]] Example 2: Input: n = 1 Outp…
原文链接: https://leetcode-cn.com/problems/add-binary 英文原文Given two binary strings a and b, return their sum as a binary string. Example 1: Input: a = "11", b = "1" Output: "100" Example 2: Input: a = "1010", b = "1011" Output: "10101" Constraints: 1 <= …
原文链接: https://leetcode-cn.com/problems/text-justification 英文原文Given an array of strings words and a width maxWidth, format the text such that each line has exactly maxWidth characters and is fully (left and right) justified. You should pack your word…
原文链接: https://leetcode-cn.com/problems/game-of-life 英文原文According to Wikipedia's article: "The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John Horton Conway in 1970." The board is made up of …
原文链接: https://leetcode-cn.com/problems/fizz-buzz 英文原文Given an integer n, return a string array answer (1-indexed) where: answer[i] == "FizzBuzz" if i is divisible by 3 and 5. answer[i] == "Fizz" if i is divisible by 3. answer[i] == "Buzz" if i is div…
原文链接: https://leetcode-cn.com/problems/add-strings 英文原文Given two non-negative integers, num1 and num2 represented as string, return the sum of num1 and num2 as a string. You must solve the problem without using any built-in library for handling large…
原文链接: https://leetcode-cn.com/problems/teemo-attacking 英文原文Our hero Teemo is attacking an enemy Ashe with poison attacks! When Teemo attacks Ashe, Ashe gets poisoned for a exactly duration seconds. More formally, an attack at second t will mean Ashe …
原文链接: https://leetcode-cn.com/problems/diagonal-traverse 英文原文Given an m x n matrix mat, return an array of all the elements of the array in a diagonal order. Example 1: Input: mat = [[1,2,3],[4,5,6],[7,8,9]] Output: [1,2,4,7,5,3,6,8,9] Example 2: Inp…
原文链接: https://leetcode-cn.com/problems/complex-number-multiplication 英文原文A complex number can be represented as a string on the form "real+imaginaryi" where: real is the real part and is an integer in the range [-100, 100]. imaginary is the imaginary…
原文链接: https://leetcode-cn.com/problems/reshape-the-matrix 英文原文In MATLAB, there is a handy function called reshape which can reshape an m x n matrix into a new one with a different size r x c keeping its original data. You are given an m x n matrix ma…
原文链接: https://leetcode-cn.com/problems/solve-the-equation 英文原文Solve a given equation and return the value of 'x' in the form of a string "x=#value". The equation contains only '+', '-' operation, the variable 'x' and its coefficient. You should retur…
原文链接: https://leetcode-cn.com/problems/robot-return-to-origin 英文原文There is a robot starting at the position (0, 0), the origin, on a 2D plane. Given a sequence of its moves, judge if this robot ends up at (0, 0) after it completes its moves. You are …
原文链接: https://leetcode-cn.com/problems/contain-virus 英文原文A virus is spreading rapidly, and your task is to quarantine the infected area by installing walls. The world is modeled as an m x n binary grid isInfected, where isInfected[i][j] == 0 represen…
原文链接: https://leetcode-cn.com/problems/flipping-an-image 英文原文Given an n x n binary matrix image, flip the image horizontally, then invert it, and return the resulting image. To flip an image horizontally means that each row of the image is reversed. …
原文链接: https://leetcode-cn.com/problems/backspace-string-compare 英文原文Given two strings s and t, return true if they are equal when both are typed into empty text editors. '#' means a backspace character. Note that after backspacing an empty text, the …
原文链接: https://leetcode-cn.com/problems/transpose-matrix 英文原文Given a 2D integer array matrix, return the transpose of matrix. The transpose of a matrix is the matrix flipped over its main diagonal, switching the matrix's row and column indices. Exampl…
原文链接: https://leetcode-cn.com/problems/walking-robot-simulation 英文原文A robot on an infinite XY-plane starts at point (0, 0) facing north. The robot can receive a sequence of these three possible types of commands: -2: Turn left 90 degrees. -1: Turn ri…
原文链接: https://leetcode-cn.com/problems/validate-stack-sequences 英文原文Given two integer arrays pushed and popped each with distinct values, return true if this could have been the result of a sequence of push and pop operations on an initially empty st…
原文链接: https://leetcode-cn.com/problems/reveal-cards-in-increasing-order 英文原文You are given an integer array deck. There is a deck of cards where every card has a unique integer. The integer on the ith card is deck[i]. You can order the deck in any ord…
原文链接: https://leetcode-cn.com/problems/sum-of-even-numbers-after-queries 英文原文You are given an integer array nums and an array queries where queries[i] = [vali, indexi]. For each query i, first, apply nums[indexi] = nums[indexi] + vali, then print the…
原文链接: https://leetcode-cn.com/problems/available-captures-for-rook 英文原文On an 8 x 8 chessboard, there is exactly one white rook 'R' and some number of white bishops 'B', black pawns 'p', and empty squares '.'. When the rook moves, it chooses one of fo…
原文链接: https://leetcode-cn.com/problems/clumsy-factorial 英文原文The factorial of a positive integer n is the product of all positive integers less than or equal to n. For example, factorial(10) = 10 * 9 * 8 * 7 * 6 * 5 * 4 * 3 * 2 * 1. We make a clumsy f…
原文链接: https://leetcode-cn.com/problems/robot-bounded-in-circle 英文原文On an infinite plane, a robot initially stands at (0, 0) and faces north. The robot can receive one of three instructions: "G": go straight 1 unit; "L": turn 90 degrees to the left; "…
原文链接: https://leetcode-cn.com/problems/car-pooling 英文原文There is a car with capacity empty seats. The vehicle only drives east (i.e., it cannot turn around and drive west). You are given the integer capacity and an array trips where trip[i] = [numPass…
原文链接: https://leetcode-cn.com/problems/distribute-candies-to-people 英文原文We distribute some number of candies, to a row of n = num_people people in the following way: We then give 1 candy to the first person, 2 candies to the second person, and so on …
原文链接: https://leetcode-cn.com/problems/where-will-the-ball-fall 英文原文You have a 2-D grid of size m x n representing a box, and you have n balls. The box is open on the top and bottom sides. Each cell in the box has a diagonal board spanning two corner…
原文链接: https://leetcode-cn.com/problems/queens-that-can-attack-the-king 英文原文On an 8x8 chessboard, there can be multiple Black Queens and one White King. Given an array of integer coordinates queens that represents the positions of the Black Queens, an…
原文链接: https://leetcode-cn.com/problems/cells-with-odd-values-in-a-matrix 英文原文There is an m x n matrix that is initialized to all 0's. There is also a 2D array indices where each indices[i] = [ri, ci] represents a 0-indexed location to perform some in…
1 / 3