-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
13abe01
commit c410517
Showing
3 changed files
with
58 additions
and
56 deletions.
There are no files selected for viewing
26 changes: 14 additions & 12 deletions
26
...rc/LeetCode.Challenges/Assessments/Largest Time for Given Digits/Description.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,26 @@ | ||
# Task | ||
|
||
Given an array arr of 4 digits, find the latest 24-hour time that can be made using each digit exactly once. | ||
|
||
24-hour times are formatted as "HH:MM", where HH is between 00 and 23, and MM is between 00 and 59. The earliest 24-hour time is 00:00, and the latest is 23:59. | ||
|
||
Return the latest 24-hour time in "HH:MM" format. If no valid time can be made, return an empty string. | ||
|
||
## Examples | ||
|
||
### Example 1: | ||
|
||
Example 1: | ||
|
||
Input: arr = [1,2,3,4] | ||
Output: "23:41" | ||
Explanation: The valid 24-hour times are "12:34", "12:43", "13:24", "13:42", "14:23", "14:32", "21:34", "21:43", "23:14", and "23:41". Of these times, "23:41" is the latest. | ||
Example 2: | ||
Input: `arr = [1,2,3,4]` | ||
Output: `23:41` | ||
Explanation: The valid 24-hour times are "12:34", "12:43", "13:24", "13:42", "14:23", "14:32", "21:34", "21:43", "23:14", and "23:41". Of these times, "23:41" is the latest. | ||
|
||
Input: arr = [5,5,5,5] | ||
Output: "" | ||
Explanation: There are no valid 24-hour times as "55:55" is not valid. | ||
### Example 2: | ||
|
||
Input: `arr = [5,5,5,5]` | ||
Output: an empty string | ||
Explanation: There are no valid 24-hour times as "55:55" is not valid. | ||
|
||
Constraints: | ||
## Constraints: | ||
|
||
arr.length == 4 | ||
0 <= arr[i] <= 9 | ||
`arr.length == 4` | ||
`0 <= arr[i] <= 9` |
52 changes: 28 additions & 24 deletions
52
...de/src/LeetCode.Challenges/Assessments/Range Sum Query - Mutable/Description.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,38 @@ | ||
# Task | ||
|
||
Given an integer array nums, handle multiple queries of the following types: | ||
|
||
Update the value of an element in nums. | ||
Calculate the sum of the elements of nums between indices left and right inclusive where left <= right. | ||
Implement the NumArray class: | ||
- Update the value of an element in nums. | ||
- Calculate the sum of the elements of nums between indices left and right inclusive where left <= right. | ||
- Implement the NumArray class: | ||
|
||
NumArray(int[] nums) Initializes the object with the integer array nums. | ||
void update(int index, int val) Updates the value of nums[index] to be val. | ||
int sumRange(int left, int right) Returns the sum of the elements of nums between indices left and right inclusive (i.e. nums[left] + nums[left + 1] + ... + nums[right]). | ||
`NumArray(int[] nums)` - Initializes the object with the integer array nums. | ||
`void update(int index, int val)` - Updates the value of nums[index] to be val. | ||
`int sumRange(int left, int right)` - Returns the sum of the elements of nums between indices left and right inclusive | ||
(i.e. nums[left] + nums[left + 1] + ... + nums[right]). | ||
|
||
## Examples | ||
|
||
Example 1: | ||
### Example 1: | ||
|
||
Input | ||
["NumArray", "sumRange", "update", "sumRange"] | ||
[[[1, 3, 5]], [0, 2], [1, 2], [0, 2]] | ||
Output | ||
[null, 9, null, 8] | ||
**Input:** | ||
`["NumArray", "sumRange", "update", "sumRange"]` | ||
`[[[1, 3, 5]], [0, 2], [1, 2], [0, 2]]` | ||
|
||
Explanation | ||
NumArray numArray = new NumArray([1, 3, 5]); | ||
numArray.sumRange(0, 2); // return 1 + 3 + 5 = 9 | ||
numArray.update(1, 2); // nums = [1, 2, 5] | ||
numArray.sumRange(0, 2); // return 1 + 2 + 5 = 8 | ||
**Output:** | ||
`[null, 9, null, 8]` | ||
|
||
**Explanation:** | ||
NumArray numArray = new NumArray([1, 3, 5]); | ||
numArray.sumRange(0, 2); // return 1 + 3 + 5 = 9 | ||
numArray.update(1, 2); // nums = [1, 2, 5] | ||
numArray.sumRange(0, 2); // return 1 + 2 + 5 = 8 | ||
|
||
Constraints: | ||
## Constraints: | ||
|
||
1 <= nums.length <= 3 * 104 | ||
-100 <= nums[i] <= 100 | ||
0 <= index < nums.length | ||
-100 <= val <= 100 | ||
0 <= left <= right < nums.length | ||
At most 3 * 104 calls will be made to update and sumRange. | ||
`1 <= nums.length <= 3 * 10^4` | ||
`-100 <= nums[i] <= 100` | ||
`0 <= index < nums.length` | ||
`-100 <= val <= 100` | ||
`0 <= left <= right < nums.length` | ||
At most `3 * 10^4` calls will be made to update and sumRange. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters