diff --git a/leetcode/problem/2-keys-keyboard.html b/leetcode/problem/2-keys-keyboard.html index 005fb77d..e5c0897c 100644 --- a/leetcode/problem/2-keys-keyboard.html +++ b/leetcode/problem/2-keys-keyboard.html @@ -1,4 +1,4 @@ -
There is only one character 'A' on the screen of a notepad. You can perform two operations on this notepad for each step:
There is only one character 'A' on the screen of a notepad. You can perform one of two operations on this notepad for each step:
Input: n = 3 Output: 3 -Explanation: Intitally, we have one character 'A'. +Explanation: Initially, we have one character 'A'. In step 1, we use Copy All operation. In step 2, we use Paste operation to get 'AA'. In step 3, we use Paste operation to get 'AAA'. diff --git a/leetcode/problem/3sum-with-multiplicity.html b/leetcode/problem/3sum-with-multiplicity.html index 3677500c..12d05a55 100644 --- a/leetcode/problem/3sum-with-multiplicity.html +++ b/leetcode/problem/3sum-with-multiplicity.html @@ -27,6 +27,14 @@ We choose one 1 from [1,1] in 2 ways, and two 2s from [2,2,2,2] in 6 ways.+
Example 3:
+ ++Input: arr = [2,1,3], target = 6 +Output: 1 +Explanation: (1, 2, 3) occured one time in the array so we return 1. ++
Constraints:
diff --git a/leetcode/problem/avoid-flood-in-the-city.html b/leetcode/problem/avoid-flood-in-the-city.html index bded8824..3cf80316 100644 --- a/leetcode/problem/avoid-flood-in-the-city.html +++ b/leetcode/problem/avoid-flood-in-the-city.html @@ -1,4 +1,4 @@ -Your country has an infinite number of lakes. Initially, all the lakes are empty, but when it rains over the nth lake, the nth lake becomes full of water. If it rains over a lake which is full of water, there will be a flood. Your goal is to avoid the flood in any lake.
Your country has an infinite number of lakes. Initially, all the lakes are empty, but when it rains over the nth lake, the nth lake becomes full of water. If it rains over a lake that is full of water, there will be a flood. Your goal is to avoid floods in any lake.
Given an integer array rains where:
If there are multiple valid answers return any of them. If it is impossible to avoid flood return an empty array.
-Notice that if you chose to dry a full lake, it becomes empty, but if you chose to dry an empty lake, nothing changes. (see example 4)
+Notice that if you chose to dry a full lake, it becomes empty, but if you chose to dry an empty lake, nothing changes.
Example 1:
diff --git a/leetcode/problem/baseball-game.html b/leetcode/problem/baseball-game.html index 5b600f28..c9e5a28f 100644 --- a/leetcode/problem/baseball-game.html +++ b/leetcode/problem/baseball-game.html @@ -9,7 +9,7 @@"C" - Invalidate the previous score, removing it from the record. It is guaranteed there will always be a previous score.Return the sum of all the scores on the record.
+Return the sum of all the scores on the record. The test cases are generated so that the answer fits in a 32-bit integer.
Example 1:
diff --git a/leetcode/problem/broken-calculator.html b/leetcode/problem/broken-calculator.html index 6ce7ca24..a82b51b5 100644 --- a/leetcode/problem/broken-calculator.html +++ b/leetcode/problem/broken-calculator.html @@ -36,5 +36,5 @@Constraints:
1 <= x, y <= 1091 <= startValue, target <= 109diff --git a/leetcode/problem/count-unique-characters-of-all-substrings-of-a-given-string.html b/leetcode/problem/count-unique-characters-of-all-substrings-of-a-given-string.html index 7a1d6741..3811f10e 100644 --- a/leetcode/problem/count-unique-characters-of-all-substrings-of-a-given-string.html +++ b/leetcode/problem/count-unique-characters-of-all-substrings-of-a-given-string.html @@ -15,7 +15,7 @@ Input: s = "ABC" Output: 10 Explanation: All possible substrings are: "A","B","C","AB","BC" and "ABC". -Evey substring is composed with only unique letters. +Every substring is composed with only unique letters. Sum of lengths of all substring is 1 + 1 + 1 + 2 + 2 + 3 = 10 diff --git a/leetcode/problem/encrypt-and-decrypt-strings.html b/leetcode/problem/encrypt-and-decrypt-strings.html index 4a522841..1877fc37 100644 --- a/leetcode/problem/encrypt-and-decrypt-strings.html +++ b/leetcode/problem/encrypt-and-decrypt-strings.html @@ -7,6 +7,8 @@
c with values[i] in the string.Note that in case a character of the string is not present in keys, the encryption process cannot be carried out, and an empty string "" is returned.
A string is decrypted with the following process:
Constraints:
1 <= nums.length <= 2001 <= nums.length <= 50-106 <= nums[i] <= 106nums are unique.5 * 104 calls in total will be made to reset and shuffle.104 calls in total will be made to reset and shuffle.A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).
You are given an m x n integer array grid. There is a robot initially located at the top-left corner (i.e., grid[0][0]). The robot tries to move to the bottom-right corner (i.e., grid[m-1][n-1]). The robot can only move either down or right at any point in time.
The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid (marked 'Finish' in the diagram below).
+An obstacle and space are marked as 1 or 0 respectively in grid. A path that the robot takes cannot include any square that is an obstacle.
Now consider if some obstacles are added to the grids. How many unique paths would there be?
+Return the number of possible unique paths that the robot can take to reach the bottom-right corner.
-An obstacle and space is marked as 1 and 0 respectively in the grid.
The testcases are generated so that the answer will be less than or equal to 2 * 109.
Example 1:
@@ -29,8 +29,8 @@ There are two ways to reach the bottom-right corner:Constraints:
m == obstacleGrid.lengthn == obstacleGrid[i].lengthm == obstacleGrid.lengthn == obstacleGrid[i].length1 <= m, n <= 100obstacleGrid[i][j] is 0 or 1.Given an integer array data representing the data, return whether it is a valid UTF-8 encoding.
Given an integer array data representing the data, return whether it is a valid UTF-8 encoding (i.e. it translates to a sequence of valid UTF-8 encoded characters).
A character in UTF8 can be from 1 to 4 bytes long, subjected to the following rules:
+A character in UTF8 can be from 1 to 4 bytes long, subjected to the following rules:
0, followed by its Unicode code.This is how the UTF-8 encoding would work:
- Char. number range | UTF-8 octet sequence
- (hexadecimal) | (binary)
- --------------------+---------------------------------------------
- 0000 0000-0000 007F | 0xxxxxxx
- 0000 0080-0000 07FF | 110xxxxx 10xxxxxx
- 0000 0800-0000 FFFF | 1110xxxx 10xxxxxx 10xxxxxx
- 0001 0000-0010 FFFF | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
+ Number of Bytes | UTF-8 Octet Sequence
+ | (binary)
+ --------------------+-----------------------------------------
+ 1 | 0xxxxxxx
+ 2 | 110xxxxx 10xxxxxx
+ 3 | 1110xxxx 10xxxxxx 10xxxxxx
+ 4 | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
-Note: The input is an array of integers. Only the least significant 8 bits of each integer is used to store the data. This means each integer represents only 1 byte of data.
+x denotes a bit in the binary form of a byte that may be either 0 or 1.
Note: The input is an array of integers. Only the least significant 8 bits of each integer is used to store the data. This means each integer represents only 1 byte of data.
Example 1: