LeetCode Super Pow Your task is to calculate ab mod 1337 where a is a positive integer and b is an extremely large positive integer given in the form of an array. Example1: a = 2 b = Result: 8 Example2: a = 2 b = Result:... Read More

# Tag Archives: 数学

# LeetCode Valid Square

LeetCode Valid Square Given the coordinates of four points in 2D space, return whether the four points could construct a square. The coordinate (x,y) of a point is represented by an integer array with two integers. Example: Input: p1 = , p2 = , p3 = ,... Read More

# LeetCode Array Nesting

LeetCode Array Nesting A zero-indexed array A consisting of N different integers is given. The array contains all integers in the range . Sets S for 0 <= K < N are defined as follows: S = { A, A], A]], ... }. Sets S are finite for each K and... Read More

# LeetCode Different Ways to Add Parentheses

LeetCode Different Ways to Add Parentheses Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. The valid operators are +, - and *. Example 1 Input:... Read More

# LeetCode Fraction Addition and Subtraction

LeetCode Fraction Addition and Subtraction Given a string representing an expression of fraction addition and subtraction, you need to return the calculation result in string format. The final result should be irreducible fraction. If your final result... Read More

# LeetCode Optimal Division

LeetCode Optimal Division Given a list of positive integers, the adjacent integers will perform the float division. For example, -> 2 / 3 / 4. However, you can add any number of parenthesis at any position to change the priority of operations. You... Read More

# LeetCode Complex Number Multiplication

LeetCode Complex Number Multiplication Given two strings representing two complex numbers. You need to return a string representing their multiplication. Note i2 = -1 according to the definition. Example 1: Input: "1+1i", "1+1i" Output:... Read More

# LeetCode Water and Jug Problem

LeetCode Water and Jug Problem You are given two jugs with capacities x and y litres. There is an infinite amount of water supply available. You need to determine whether it is possible to measure exactly z litres using these two jugs. If z liters of... Read More

# LeetCode Lexicographical Numbers

LeetCode Lexicographical Numbers Given an integer n, return 1 - n in lexicographical order. For example, given 13, return: . Please optimize your algorithm to use less time and space. The input size may be as large as... Read More

# LeetCode Bulb Switcher

LeetCode Bulb Switcher There are n bulbs that are initially off. You first turn on all the bulbs. Then, you turn off every second bulb. On the third round, you toggle every third bulb (turning on if it's off or turning off if it's on). For the ith... Read More