inputs stringlengths 365 1.54k | targets stringclasses 12
values | _template_idx int64 0 9 | _task_source stringclasses 1
value | _task_name stringclasses 1
value | _template_type stringclasses 2
values |
|---|---|---|---|---|---|
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
Let me give you an example: [1,2,2,3]
The answer to this example can be: 1
Here is why: The array is monotonic as 1 < 2 <= 2 < 3
OK. solve this:
[68, 17, 43, 6, 65, 41, 32, 98, 53, 29]
Answer: | 2 | 8 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
[134, 125, 116, 107, 98, 89, 80, 71, 62, 53, 44, 35]
1
[26, 12, 54, 82, 85, 23, 51, 88, 60, 11]
2
[6, 35, 69, 29, 37, 53, 84, 7, 56, 1]
| 2
| 0 | NIv2 | task1089_check_monotonic_array | fs_opt |
Detailed Instructions: You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
See one example below:
Problem: [1,2,2,3]
Solution: 1
Explanation: The array is monotonic as 1 < 2 <= 2 < 3
Problem: [28, 37, 46, 55, 64, 73, 82, 91, 100, 109, 118, 127]
Solution: | 1 | 4 | NIv2 | task1089_check_monotonic_array | fs_opt |
Teacher: You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
Teacher: Now, understand the problem? If you are still confused, see the following example:
[1,2,2,3]
Solution: 1
Reason: The array is monotonic as 1 < 2 <= 2 < 3
Now, solve this instance: [80, 4, 43, 3, 2, 11, 83, 93, 38, 59]
Student: | 2 | 2 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
Input: Consider Input: [6, 62, 90, 10, 27, 71, 40, 67, 64, 47]
Output: 2
Input: Consider Input: [9, 16, 23, 30, 37, 44, 51, 58, 65, 72, 79, 86, 93, 100, 107, 114, 121, 128, 135, 142, 149, 156, 163]
Output: 1
Input: Consider Input: [156, 146, 136, 126, 116, 106, 96, 86, 76, 66, 56, 46, 36, 26]
| Output: 1
| 2 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
Example: [1,2,2,3]
Example solution: 1
Example explanation: The array is monotonic as 1 < 2 <= 2 < 3
Problem: [88, 94, 68, 70, 49, 66, 91, 35, 17, 15]
| Solution: 2 | 5 | NIv2 | task1089_check_monotonic_array | fs_opt |
TASK DEFINITION: You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
PROBLEM: [123, 121, 119, 117, 115, 113, 111, 109, 107, 105, 103, 101, 99, 97, 95, 93, 91, 89, 87, 85, 83, 81, 79, 77, 75, 73, 71, 69, 67, 65, 63, 61, 59, 57, 55, 53, 51, 49, 47, 45, 43, 41, 39, 37, 35, 33, 31, 29, 27, 25, 23, 21]
SOLUTION: 1
PROBLEM: [49, 57, 65, 73, 81, 89, 97]
SOLUTION: 1
PROBLEM: [22, 0, 4, 45, 87, 13, 38, 35, 12, 72]
SOLUTION: | 2
| 8 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
One example is below.
Q: [1,2,2,3]
A: 1
Rationale: The array is monotonic as 1 < 2 <= 2 < 3
Q: [181, 171, 161, 151, 141, 131, 121, 111, 101, 91, 81, 71, 61, 51, 41, 31]
A: | 1 | 9 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
--------
Question: [12, 88, 35, 86, 62, 67, 7, 45, 9, 72]
Answer: 2
Question: [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164, 166, 168]
Answer: 1
Question: [181, 171, 161, 151, 141, 131, 121, 111, 101, 91, 81, 71, 61, 51, 41, 31]
Answer: | 1
| 7 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
Example: [1,2,2,3]
Example solution: 1
Example explanation: The array is monotonic as 1 < 2 <= 2 < 3
Problem: [174, 166, 158, 150, 142, 134, 126, 118, 110, 102, 94, 86, 78, 70, 62, 54, 46, 38]
| Solution: 1 | 5 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
[61, 60, 12, 84, 10, 39, 90, 92, 6, 38]
2
[17, 24, 31, 38, 45, 52, 59, 66, 73, 80, 87, 94, 101, 108]
1
[174, 166, 158, 150, 142, 134, 126, 118, 110, 102, 94, 86, 78, 70, 62, 54, 46, 38]
| 1
| 0 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
[Q]: [97, 74, 13, 1, 60, 79, 28, 53, 6, 44]
[A]: 2
[Q]: [102, 99, 96, 93, 90, 87, 84, 81, 78, 75, 72, 69, 66, 63, 60, 57, 54, 51, 48, 45, 42, 39, 36, 33]
[A]: 1
[Q]: [101, 93, 85, 77, 69, 61, 53]
[A]: | 1
| 5 | NIv2 | task1089_check_monotonic_array | fs_opt |
Detailed Instructions: You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
See one example below:
Problem: [1,2,2,3]
Solution: 1
Explanation: The array is monotonic as 1 < 2 <= 2 < 3
Problem: [7, 15, 23, 31, 39, 47, 55, 63, 71, 79, 87, 95, 103, 111, 119, 127, 135, 143, 151, 159, 167, 175, 183]
Solution: | 1 | 4 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
Ex Input:
[1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109]
Ex Output:
1
Ex Input:
[113, 105, 97, 89, 81, 73, 65, 57, 49, 41, 33]
Ex Output:
1
Ex Input:
[7, 83, 48, 59, 42, 13, 29, 87, 3, 15]
Ex Output:
| 2
| 1 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
Input: Consider Input: [16, 15, 94, 30, 83, 56, 81, 47, 78, 5]
Output: 2
Input: Consider Input: [143, 137, 131, 125, 119, 113, 107, 101, 95, 89, 83, 77, 71, 65, 59, 53, 47, 41, 35]
Output: 1
Input: Consider Input: [17, 27, 37, 47, 57, 67, 77, 87, 97, 107, 117, 127, 137, 147, 157, 167, 177, 187, 197]
| Output: 1
| 2 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
Example input: [1,2,2,3]
Example output: 1
Example explanation: The array is monotonic as 1 < 2 <= 2 < 3
Q: [49, 57, 65, 73, 81, 89, 97]
A: | 1 | 3 | NIv2 | task1089_check_monotonic_array | fs_opt |
Given the task definition, example input & output, solve the new input case.
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
Example: [1,2,2,3]
Output: 1
The array is monotonic as 1 < 2 <= 2 < 3
New input case for you: [32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120, 128, 136, 144, 152, 160, 168]
Output: | 1 | 1 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
--------
Question: [97, 74, 13, 1, 60, 79, 28, 53, 6, 44]
Answer: 2
Question: [20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122]
Answer: 1
Question: [32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120, 128, 136, 144, 152, 160, 168]
Answer: | 1
| 7 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
[166, 159, 152, 145, 138, 131, 124, 117, 110, 103, 96, 89, 82, 75, 68, 61, 54, 47, 40, 33, 26]
1
[53, 89, 39, 0, 3, 90, 61, 56, 13, 34]
2
[120, 117, 114, 111, 108, 105, 102, 99, 96, 93, 90, 87, 84, 81, 78, 75, 72, 69, 66, 63, 60, 57, 54, 51, 48, 45, 42, 39]
| 1
| 0 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
Example Input: [15, 67, 9, 42, 92, 82, 37, 87, 64, 12]
Example Output: 2
Example Input: [7, 83, 48, 59, 42, 13, 29, 87, 3, 15]
Example Output: 2
Example Input: [113, 107, 101, 95, 89, 83, 77, 71, 65, 59, 53, 47, 41, 35, 29, 23, 17, 11]
Example Output: | 1
| 3 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
One example is below.
Q: [1,2,2,3]
A: 1
Rationale: The array is monotonic as 1 < 2 <= 2 < 3
Q: [12, 88, 35, 86, 62, 67, 7, 45, 9, 72]
A: | 2 | 9 | NIv2 | task1089_check_monotonic_array | fs_opt |
Detailed Instructions: You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
See one example below:
Problem: [1,2,2,3]
Solution: 1
Explanation: The array is monotonic as 1 < 2 <= 2 < 3
Problem: [115, 108, 101, 94, 87, 80, 73, 66, 59, 52, 45, 38, 31, 24]
Solution: | 1 | 4 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
[EX Q]: [49, 57, 65, 73, 81, 89, 97]
[EX A]: 1
[EX Q]: [45, 51, 57, 63, 69, 75, 81, 87, 93, 99, 105, 111, 117, 123, 129, 135]
[EX A]: 1
[EX Q]: [6, 12, 18, 24, 30, 36, 42, 48, 54, 60, 66, 72, 78, 84, 90, 96, 102, 108]
[EX A]: | 1
| 6 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
Example Input: [166, 162, 158, 154, 150, 146, 142, 138, 134, 130, 126, 122, 118, 114, 110, 106, 102, 98, 94, 90, 86, 82, 78, 74, 70, 66, 62, 58, 54, 50, 46, 42, 38, 34, 30, 26, 22, 18, 14]
Example Output: 1
Example Input: [11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, 119, 121, 123, 125, 127, 129, 131, 133, 135, 137]
Example Output: 1
Example Input: [184, 182, 180, 178, 176, 174, 172, 170, 168, 166, 164, 162, 160, 158, 156, 154, 152, 150, 148, 146, 144, 142, 140, 138, 136, 134, 132, 130, 128, 126, 124, 122, 120, 118, 116, 114, 112, 110, 108, 106, 104, 102, 100, 98, 96, 94, 92, 90, 88, 86, 84, 82, 80, 78, 76, 74, 72, 70, 68, 66, 64, 62, 60, 58, 56, 54, 52, 50, 48, 46, 44, 42, 40, 38]
Example Output: | 1
| 3 | NIv2 | task1089_check_monotonic_array | fs_opt |
Given the task definition, example input & output, solve the new input case.
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
Example: [1,2,2,3]
Output: 1
The array is monotonic as 1 < 2 <= 2 < 3
New input case for you: [9, 16, 23, 30, 37, 44, 51, 58, 65, 72, 79, 86, 93, 100, 107, 114, 121, 128, 135, 142, 149, 156, 163]
Output: | 1 | 1 | NIv2 | task1089_check_monotonic_array | fs_opt |
Part 1. Definition
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
Part 2. Example
[1,2,2,3]
Answer: 1
Explanation: The array is monotonic as 1 < 2 <= 2 < 3
Part 3. Exercise
[102, 99, 96, 93, 90, 87, 84, 81, 78, 75, 72, 69, 66, 63, 60, 57, 54, 51, 48, 45, 42, 39, 36, 33]
Answer: | 1 | 7 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
Input: Consider Input: [7, 15, 23, 31, 39, 47, 55, 63, 71, 79, 87, 95, 103, 111, 119, 127, 135, 143, 151, 159, 167, 175, 183]
Output: 1
Input: Consider Input: [53, 89, 39, 0, 3, 90, 61, 56, 13, 34]
Output: 2
Input: Consider Input: [102, 99, 96, 93, 90, 87, 84, 81, 78, 75, 72, 69, 66, 63, 60, 57, 54, 51, 48, 45, 42, 39, 36, 33]
| Output: 1
| 2 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
Example Input: [4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140]
Example Output: 1
Example Input: [48, 71, 3, 82, 87, 96, 86, 57, 69, 59]
Example Output: 2
Example Input: [166, 159, 152, 145, 138, 131, 124, 117, 110, 103, 96, 89, 82, 75, 68, 61, 54, 47, 40, 33, 26]
Example Output: | 1
| 3 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
--------
Question: [17, 27, 37, 47, 57, 67, 77, 87, 97, 107, 117, 127, 137, 147, 157, 167, 177, 187, 197]
Answer: 1
Question: [28, 36, 44, 52, 60, 68, 76, 84, 92, 100, 108, 116, 124, 132, 140, 148, 156, 164, 172]
Answer: 1
Question: [23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187]
Answer: | 1
| 7 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
One example: [1,2,2,3]
Solution is here: 1
Explanation: The array is monotonic as 1 < 2 <= 2 < 3
Now, solve this: [13, 20, 27, 34, 41, 48, 55, 62, 69, 76, 83, 90, 97, 104, 111, 118, 125, 132, 139, 146, 153, 160, 167]
Solution: | 1 | 6 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
One example is below.
Q: [1,2,2,3]
A: 1
Rationale: The array is monotonic as 1 < 2 <= 2 < 3
Q: [35, 42, 49, 56, 63, 70, 77, 84, 91, 98, 105]
A: | 1 | 9 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
[166, 159, 152, 145, 138, 131, 124, 117, 110, 103, 96, 89, 82, 75, 68, 61, 54, 47, 40, 33, 26]
1
[13, 20, 27, 34, 41, 48, 55, 62, 69, 76, 83, 90, 97, 104, 111, 118, 125, 132, 139, 146, 153, 160, 167]
1
[68, 17, 43, 6, 65, 41, 32, 98, 53, 29]
| 2
| 0 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
Example Input: [38, 41, 44, 47, 50, 53, 56, 59, 62, 65, 68, 71, 74, 77, 80, 83, 86, 89, 92, 95, 98, 101, 104, 107, 110, 113, 116, 119]
Example Output: 1
Example Input: [68, 33, 21, 85, 24, 59, 93, 55, 78, 13]
Example Output: 2
Example Input: [88, 94, 68, 70, 49, 66, 91, 35, 17, 15]
Example Output: | 2
| 3 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
[Q]: [170, 163, 156, 149, 142, 135, 128, 121, 114, 107, 100, 93, 86, 79, 72, 65, 58, 51, 44, 37, 30, 23, 16, 9]
[A]: 1
[Q]: [28, 37, 46, 55, 64, 73, 82, 91, 100, 109, 118, 127]
[A]: 1
[Q]: [4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, 84, 88, 92, 96, 100, 104, 108, 112, 116, 120]
[A]: | 1
| 5 | NIv2 | task1089_check_monotonic_array | fs_opt |
Detailed Instructions: You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
See one example below:
Problem: [1,2,2,3]
Solution: 1
Explanation: The array is monotonic as 1 < 2 <= 2 < 3
Problem: [3, 24, 19, 66, 97, 6, 82, 81, 72, 12]
Solution: | 2 | 4 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
One example is below.
Q: [1,2,2,3]
A: 1
Rationale: The array is monotonic as 1 < 2 <= 2 < 3
Q: [20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122]
A: | 1 | 9 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
[EX Q]: [23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187]
[EX A]: 1
[EX Q]: [31, 38, 72, 90, 93, 20, 45, 40, 52, 41]
[EX A]: 2
[EX Q]: [32, 35, 38, 41, 44, 47, 50, 53, 56, 59, 62, 65, 68, 71, 74, 77, 80, 83, 86, 89, 92, 95, 98, 101]
[EX A]: | 1
| 6 | NIv2 | task1089_check_monotonic_array | fs_opt |
TASK DEFINITION: You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
PROBLEM: [49, 57, 65, 73, 81, 89, 97]
SOLUTION: 1
PROBLEM: [4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140]
SOLUTION: 1
PROBLEM: [61, 60, 12, 84, 10, 39, 90, 92, 6, 38]
SOLUTION: | 2
| 8 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
One example is below.
Q: [1,2,2,3]
A: 1
Rationale: The array is monotonic as 1 < 2 <= 2 < 3
Q: [149, 148, 147, 146, 145, 144, 143, 142, 141, 140, 139, 138, 137, 136, 135, 134, 133, 132, 131, 130, 129, 128, 127, 126, 125, 124, 123, 122, 121, 120, 119, 118, 117, 116, 115, 114, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15]
A: | 1 | 9 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
One example: [1,2,2,3]
Solution is here: 1
Explanation: The array is monotonic as 1 < 2 <= 2 < 3
Now, solve this: [4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140]
Solution: | 1 | 6 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
Let me give you an example: [1,2,2,3]
The answer to this example can be: 1
Here is why: The array is monotonic as 1 < 2 <= 2 < 3
OK. solve this:
[14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148]
Answer: | 1 | 8 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
Input: Consider Input: [3, 75, 96, 40, 12, 21, 95, 4, 80, 85]
Output: 2
Input: Consider Input: [7, 68, 4, 23, 34, 61, 98, 5, 15, 26]
Output: 2
Input: Consider Input: [14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148]
| Output: 1
| 2 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
[Q]: [141, 139, 137, 135, 133, 131, 129, 127, 125, 123, 121, 119, 117, 115, 113, 111, 109, 107, 105, 103, 101, 99, 97, 95, 93, 91, 89, 87, 85, 83, 81, 79, 77, 75, 73, 71, 69, 67, 65, 63, 61, 59, 57, 55, 53, 51, 49, 47, 45, 43, 41, 39, 37, 35, 33, 31, 29, 27, 25, 23, 21, 19, 17, 15, 13, 11, 9, 7, 5]
[A]: 1
[Q]: [47, 56, 65, 74, 83, 92, 101, 110, 119, 128, 137, 146, 155, 164, 173, 182, 191]
[A]: 1
[Q]: [148, 143, 138, 133, 128, 123, 118, 113, 108, 103, 98, 93, 88, 83, 78, 73, 68, 63, 58, 53, 48, 43, 38, 33, 28, 23]
[A]: | 1
| 5 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
Let me give you an example: [1,2,2,3]
The answer to this example can be: 1
Here is why: The array is monotonic as 1 < 2 <= 2 < 3
OK. solve this:
[81, 69, 13, 34, 10, 80, 33, 7, 86, 65]
Answer: | 2 | 8 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
Input: Consider Input: [81, 47, 2, 60, 16, 80, 1, 89, 37, 3]
Output: 2
Input: Consider Input: [19, 28, 37, 46, 55, 64, 73, 82, 91, 100, 109, 118, 127, 136, 145, 154, 163, 172, 181, 190]
Output: 1
Input: Consider Input: [45, 51, 57, 63, 69, 75, 81, 87, 93, 99, 105, 111, 117, 123, 129, 135]
| Output: 1
| 2 | NIv2 | task1089_check_monotonic_array | fs_opt |
Teacher: You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
Teacher: Now, understand the problem? If you are still confused, see the following example:
[1,2,2,3]
Solution: 1
Reason: The array is monotonic as 1 < 2 <= 2 < 3
Now, solve this instance: [28, 36, 44, 52, 60, 68, 76, 84, 92, 100, 108]
Student: | 1 | 2 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
Ex Input:
[15, 67, 9, 42, 92, 82, 37, 87, 64, 12]
Ex Output:
2
Ex Input:
[71, 45, 54, 41, 73, 74, 32, 38, 53, 18]
Ex Output:
2
Ex Input:
[48, 71, 3, 82, 87, 96, 86, 57, 69, 59]
Ex Output:
| 2
| 1 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
One example is below.
Q: [1,2,2,3]
A: 1
Rationale: The array is monotonic as 1 < 2 <= 2 < 3
Q: [121, 117, 113, 109, 105, 101, 97, 93, 89, 85, 81, 77, 73, 69, 65, 61, 57, 53, 49, 45, 41, 37, 33, 29, 25, 21, 17, 13, 9, 5]
A: | 1 | 9 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
Ex Input:
[163, 154, 145, 136, 127, 118, 109, 100, 91, 82, 73, 64, 55, 46, 37]
Ex Output:
1
Ex Input:
[1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109]
Ex Output:
1
Ex Input:
[183, 178, 173, 168, 163, 158, 153, 148, 143, 138, 133, 128, 123, 118, 113, 108, 103, 98, 93, 88, 83, 78, 73, 68, 63, 58, 53, 48, 43]
Ex Output:
| 1
| 1 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
Example input: [1,2,2,3]
Example output: 1
Example explanation: The array is monotonic as 1 < 2 <= 2 < 3
Q: [41, 10, 1, 63, 24, 69, 71, 43, 37, 50]
A: | 2 | 3 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
Input: Consider Input: [94, 77, 79, 78, 20, 52, 24, 70, 5, 28]
Output: 2
Input: Consider Input: [92, 44, 43, 88, 42, 91, 54, 51, 79, 45]
Output: 2
Input: Consider Input: [41, 10, 1, 63, 24, 69, 71, 43, 37, 50]
| Output: 2
| 2 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
Example input: [1,2,2,3]
Example output: 1
Example explanation: The array is monotonic as 1 < 2 <= 2 < 3
Q: [199, 189, 179, 169, 159, 149, 139, 129, 119, 109, 99, 89, 79, 69, 59, 49, 39, 29, 19]
A: | 1 | 3 | NIv2 | task1089_check_monotonic_array | fs_opt |
Part 1. Definition
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
Part 2. Example
[1,2,2,3]
Answer: 1
Explanation: The array is monotonic as 1 < 2 <= 2 < 3
Part 3. Exercise
[69, 49, 60, 58, 48, 82, 21, 83, 26, 67]
Answer: | 2 | 7 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
Input: Consider Input: [183, 178, 173, 168, 163, 158, 153, 148, 143, 138, 133, 128, 123, 118, 113, 108, 103, 98, 93, 88, 83, 78, 73, 68, 63, 58, 53, 48, 43]
Output: 1
Input: Consider Input: [20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122]
Output: 1
Input: Consider Input: [37, 82, 28, 10, 76, 2, 63, 61, 54, 73]
| Output: 2
| 2 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
Input: Consider Input: [43, 48, 53, 58, 63, 68, 73, 78, 83, 88, 93, 98, 103, 108, 113, 118, 123, 128, 133, 138, 143, 148, 153, 158, 163, 168, 173]
Output: 1
Input: Consider Input: [19, 28, 37, 46, 55, 64, 73, 82, 91, 100, 109, 118, 127, 136, 145, 154, 163, 172, 181, 190]
Output: 1
Input: Consider Input: [24, 31, 38, 45, 52, 59, 66, 73, 80, 87, 94, 101, 108, 115, 122, 129, 136, 143, 150, 157, 164]
| Output: 1
| 2 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
One example is below.
Q: [1,2,2,3]
A: 1
Rationale: The array is monotonic as 1 < 2 <= 2 < 3
Q: [141, 139, 137, 135, 133, 131, 129, 127, 125, 123, 121, 119, 117, 115, 113, 111, 109, 107, 105, 103, 101, 99, 97, 95, 93, 91, 89, 87, 85, 83, 81, 79, 77, 75, 73, 71, 69, 67, 65, 63, 61, 59, 57, 55, 53, 51, 49, 47, 45, 43, 41, 39, 37, 35, 33, 31, 29, 27, 25, 23, 21, 19, 17, 15, 13, 11, 9, 7, 5]
A: | 1 | 9 | NIv2 | task1089_check_monotonic_array | fs_opt |
Part 1. Definition
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
Part 2. Example
[1,2,2,3]
Answer: 1
Explanation: The array is monotonic as 1 < 2 <= 2 < 3
Part 3. Exercise
[188, 187, 186, 185, 184, 183, 182, 181, 180, 179, 178, 177, 176, 175, 174, 173, 172, 171, 170, 169, 168, 167, 166, 165, 164, 163, 162, 161, 160, 159, 158, 157, 156, 155, 154, 153, 152, 151, 150, 149, 148, 147, 146, 145, 144, 143, 142, 141, 140, 139, 138, 137, 136, 135, 134, 133, 132, 131, 130, 129, 128, 127, 126, 125, 124, 123, 122, 121, 120, 119, 118, 117, 116, 115, 114, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24]
Answer: | 1 | 7 | NIv2 | task1089_check_monotonic_array | fs_opt |
Detailed Instructions: You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
See one example below:
Problem: [1,2,2,3]
Solution: 1
Explanation: The array is monotonic as 1 < 2 <= 2 < 3
Problem: [55, 27, 83, 68, 4, 81, 88, 70, 52, 11]
Solution: | 2 | 4 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
Example Input: [5, 66, 84, 32, 18, 94, 82, 74, 97, 60]
Example Output: 2
Example Input: [143, 135, 127, 119, 111, 103, 95, 87, 79, 71, 63, 55, 47, 39]
Example Output: 1
Example Input: [6, 13, 20, 27, 34, 41, 48, 55, 62, 69, 76, 83, 90, 97, 104, 111, 118, 125, 132, 139, 146, 153, 160, 167]
Example Output: | 1
| 3 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
[EX Q]: [69, 49, 60, 58, 48, 82, 21, 83, 26, 67]
[EX A]: 2
[EX Q]: [68, 17, 43, 6, 65, 41, 32, 98, 53, 29]
[EX A]: 2
[EX Q]: [23, 33, 43, 53, 63, 73, 83, 93, 103, 113, 123, 133, 143, 153]
[EX A]: | 1
| 6 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
Let me give you an example: [1,2,2,3]
The answer to this example can be: 1
Here is why: The array is monotonic as 1 < 2 <= 2 < 3
OK. solve this:
[58, 57, 28, 98, 25, 53, 38, 29, 33, 11]
Answer: | 2 | 8 | NIv2 | task1089_check_monotonic_array | fs_opt |
Teacher: You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
Teacher: Now, understand the problem? If you are still confused, see the following example:
[1,2,2,3]
Solution: 1
Reason: The array is monotonic as 1 < 2 <= 2 < 3
Now, solve this instance: [185, 177, 169, 161, 153, 145, 137, 129, 121, 113, 105, 97, 89, 81, 73, 65, 57, 49, 41, 33, 25, 17, 9]
Student: | 1 | 2 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
One example: [1,2,2,3]
Solution is here: 1
Explanation: The array is monotonic as 1 < 2 <= 2 < 3
Now, solve this: [154, 150, 146, 142, 138, 134, 130, 126, 122, 118, 114, 110, 106, 102, 98, 94, 90, 86, 82, 78, 74, 70, 66, 62, 58, 54, 50, 46, 42, 38, 34, 30, 26, 22, 18, 14]
Solution: | 1 | 6 | NIv2 | task1089_check_monotonic_array | fs_opt |
Teacher: You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
Teacher: Now, understand the problem? If you are still confused, see the following example:
[1,2,2,3]
Solution: 1
Reason: The array is monotonic as 1 < 2 <= 2 < 3
Now, solve this instance: [46, 54, 62, 70, 78, 86, 94, 102, 110, 118, 126, 134, 142, 150, 158, 166]
Student: | 1 | 2 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
Example: [1,2,2,3]
Example solution: 1
Example explanation: The array is monotonic as 1 < 2 <= 2 < 3
Problem: [62, 5, 16, 87, 73, 24, 43, 57, 6, 51]
| Solution: 2 | 5 | NIv2 | task1089_check_monotonic_array | fs_opt |
Detailed Instructions: You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
See one example below:
Problem: [1,2,2,3]
Solution: 1
Explanation: The array is monotonic as 1 < 2 <= 2 < 3
Problem: [46, 56, 16, 32, 99, 30, 57, 93, 64, 28]
Solution: | 2 | 4 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
Example: [1,2,2,3]
Example solution: 1
Example explanation: The array is monotonic as 1 < 2 <= 2 < 3
Problem: [85, 78, 15, 4, 92, 46, 98, 81, 38, 86]
| Solution: 2 | 5 | NIv2 | task1089_check_monotonic_array | fs_opt |
TASK DEFINITION: You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
PROBLEM: [98, 33, 77, 20, 75, 1, 47, 0, 11, 5]
SOLUTION: 2
PROBLEM: [141, 139, 137, 135, 133, 131, 129, 127, 125, 123, 121, 119, 117, 115, 113, 111, 109, 107, 105, 103, 101, 99, 97, 95, 93, 91, 89, 87, 85, 83, 81, 79, 77, 75, 73, 71, 69, 67, 65, 63, 61, 59, 57, 55, 53, 51, 49, 47, 45, 43, 41, 39, 37, 35, 33, 31, 29, 27, 25, 23, 21, 19, 17, 15, 13, 11, 9, 7, 5]
SOLUTION: 1
PROBLEM: [46, 56, 16, 32, 99, 30, 57, 93, 64, 28]
SOLUTION: | 2
| 8 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
[195, 194, 193, 192, 191, 190, 189, 188, 187, 186, 185, 184, 183, 182, 181, 180, 179, 178, 177, 176, 175, 174, 173, 172, 171, 170, 169, 168, 167, 166, 165, 164, 163, 162, 161, 160, 159, 158, 157, 156, 155, 154, 153, 152, 151, 150, 149, 148, 147, 146, 145, 144, 143, 142, 141, 140, 139, 138, 137, 136, 135, 134, 133, 132, 131, 130, 129, 128, 127, 126, 125, 124, 123, 122, 121, 120, 119, 118, 117, 116, 115, 114, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49]
1
[176, 171, 166, 161, 156, 151, 146, 141, 136, 131, 126, 121, 116, 111, 106, 101, 96, 91, 86, 81, 76, 71, 66, 61, 56, 51, 46]
1
[85, 78, 15, 4, 92, 46, 98, 81, 38, 86]
| 2
| 0 | NIv2 | task1089_check_monotonic_array | fs_opt |
TASK DEFINITION: You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
PROBLEM: [148, 143, 138, 133, 128, 123, 118, 113, 108, 103, 98, 93, 88, 83, 78, 73, 68, 63, 58, 53, 48, 43, 38, 33, 28, 23]
SOLUTION: 1
PROBLEM: [37, 9, 23, 27, 77, 74, 50, 69, 52, 76]
SOLUTION: 2
PROBLEM: [29, 35, 41, 47, 53, 59, 65, 71, 77, 83, 89, 95, 101, 107, 113, 119, 125, 131, 137]
SOLUTION: | 1
| 8 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
One example is below.
Q: [1,2,2,3]
A: 1
Rationale: The array is monotonic as 1 < 2 <= 2 < 3
Q: [175, 167, 159, 151, 143, 135, 127, 119, 111, 103, 95, 87, 79, 71, 63, 55, 47, 39, 31]
A: | 1 | 9 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
Example: [1,2,2,3]
Example solution: 1
Example explanation: The array is monotonic as 1 < 2 <= 2 < 3
Problem: [25, 67, 73, 85, 50, 7, 97, 17, 43, 38]
| Solution: 2 | 5 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
Let me give you an example: [1,2,2,3]
The answer to this example can be: 1
Here is why: The array is monotonic as 1 < 2 <= 2 < 3
OK. solve this:
[33, 43, 53, 63, 73, 83, 93, 103, 113, 123, 133, 143, 153, 163]
Answer: | 1 | 8 | NIv2 | task1089_check_monotonic_array | fs_opt |
Given the task definition, example input & output, solve the new input case.
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
Example: [1,2,2,3]
Output: 1
The array is monotonic as 1 < 2 <= 2 < 3
New input case for you: [6, 62, 90, 10, 27, 71, 40, 67, 64, 47]
Output: | 2 | 1 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
One example is below.
Q: [1,2,2,3]
A: 1
Rationale: The array is monotonic as 1 < 2 <= 2 < 3
Q: [86, 50, 98, 96, 66, 38, 57, 56, 58, 65]
A: | 2 | 9 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
--------
Question: [140, 134, 128, 122, 116, 110, 104, 98, 92, 86, 80, 74, 68, 62, 56, 50]
Answer: 1
Question: [94, 77, 79, 78, 20, 52, 24, 70, 5, 28]
Answer: 2
Question: [6, 62, 90, 10, 27, 71, 40, 67, 64, 47]
Answer: | 2
| 7 | NIv2 | task1089_check_monotonic_array | fs_opt |
You will be given a definition of a task first, then an example. Follow the example to solve a new instance of the task.
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
[1,2,2,3]
Solution: 1
Why? The array is monotonic as 1 < 2 <= 2 < 3
New input: [31, 38, 72, 90, 93, 20, 45, 40, 52, 41]
Solution: | 2 | 0 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
[48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194]
1
[26, 65, 35, 76, 80, 18, 74, 19, 32, 78]
2
[169, 162, 155, 148, 141, 134, 127, 120, 113, 106, 99, 92, 85, 78, 71, 64, 57, 50, 43, 36, 29, 22, 15]
| 1
| 0 | NIv2 | task1089_check_monotonic_array | fs_opt |
Teacher: You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
Teacher: Now, understand the problem? If you are still confused, see the following example:
[1,2,2,3]
Solution: 1
Reason: The array is monotonic as 1 < 2 <= 2 < 3
Now, solve this instance: [94, 77, 79, 78, 20, 52, 24, 70, 5, 28]
Student: | 2 | 2 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
[Q]: [12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, 84, 88, 92, 96, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 148, 152]
[A]: 1
[Q]: [195, 186, 177, 168, 159, 150, 141, 132, 123, 114, 105, 96, 87, 78, 69, 60, 51]
[A]: 1
[Q]: [94, 77, 79, 78, 20, 52, 24, 70, 5, 28]
[A]: | 2
| 5 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
[26, 65, 35, 76, 80, 18, 74, 19, 32, 78]
2
[12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164, 166, 168, 170, 172, 174, 176, 178, 180, 182, 184, 186, 188, 190, 192, 194, 196]
1
[113, 105, 97, 89, 81, 73, 65, 57, 49, 41, 33]
| 1
| 0 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
[55, 27, 83, 68, 4, 81, 88, 70, 52, 11]
2
[22, 0, 4, 45, 87, 13, 38, 35, 12, 72]
2
[10, 14, 18, 22, 26, 30, 34, 38, 42, 46, 50, 54, 58, 62, 66, 70, 74, 78, 82, 86, 90, 94, 98, 102, 106, 110, 114, 118, 122, 126, 130, 134, 138, 142, 146, 150, 154, 158, 162]
| 1
| 0 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
One example is below.
Q: [1,2,2,3]
A: 1
Rationale: The array is monotonic as 1 < 2 <= 2 < 3
Q: [81, 53, 10, 74, 25, 45, 80, 69, 44, 13]
A: | 2 | 9 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
Example Input: [120, 117, 114, 111, 108, 105, 102, 99, 96, 93, 90, 87, 84, 81, 78, 75, 72, 69, 66, 63, 60, 57, 54, 51, 48, 45, 42, 39]
Example Output: 1
Example Input: [12, 40, 45, 65, 87, 43, 80, 67, 76, 56]
Example Output: 2
Example Input: [143, 138, 133, 128, 123, 118, 113, 108, 103, 98, 93, 88, 83, 78, 73, 68, 63, 58, 53, 48, 43, 38, 33, 28, 23]
Example Output: | 1
| 3 | NIv2 | task1089_check_monotonic_array | fs_opt |
instruction:
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
question:
[47, 56, 65, 74, 83, 92, 101, 110, 119, 128, 137, 146, 155, 164, 173, 182, 191]
answer:
1
question:
[2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164, 166, 168]
answer:
1
question:
[15, 67, 9, 42, 92, 82, 37, 87, 64, 12]
answer:
| 2
| 9 | NIv2 | task1089_check_monotonic_array | fs_opt |
Given the task definition, example input & output, solve the new input case.
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
Example: [1,2,2,3]
Output: 1
The array is monotonic as 1 < 2 <= 2 < 3
New input case for you: [163, 154, 145, 136, 127, 118, 109, 100, 91, 82, 73, 64, 55, 46, 37]
Output: | 1 | 1 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
[Q]: [6, 13, 20, 27, 34, 41, 48, 55, 62, 69, 76, 83, 90, 97, 104, 111, 118, 125, 132, 139, 146, 153, 160, 167]
[A]: 1
[Q]: [28, 37, 46, 55, 64, 73, 82, 91, 100, 109, 118, 127]
[A]: 1
[Q]: [99, 2, 21, 75, 68, 11, 60, 96, 30, 38]
[A]: | 2
| 5 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
[32, 35, 38, 41, 44, 47, 50, 53, 56, 59, 62, 65, 68, 71, 74, 77, 80, 83, 86, 89, 92, 95, 98, 101]
1
[3, 24, 19, 66, 97, 6, 82, 81, 72, 12]
2
[96, 85, 77, 11, 60, 55, 34, 37, 46, 10]
| 2
| 0 | NIv2 | task1089_check_monotonic_array | fs_opt |
You will be given a definition of a task first, then an example. Follow the example to solve a new instance of the task.
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
[1,2,2,3]
Solution: 1
Why? The array is monotonic as 1 < 2 <= 2 < 3
New input: [109, 102, 95, 88, 81, 74, 67, 60, 53, 46, 39]
Solution: | 1 | 0 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
Input: Consider Input: [13, 20, 27, 34, 41, 48, 55, 62, 69, 76, 83, 90, 97, 104, 111, 118, 125, 132, 139, 146, 153, 160, 167]
Output: 1
Input: Consider Input: [134, 125, 116, 107, 98, 89, 80, 71, 62, 53, 44, 35]
Output: 1
Input: Consider Input: [114, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49]
| Output: 1
| 2 | NIv2 | task1089_check_monotonic_array | fs_opt |
Detailed Instructions: You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
See one example below:
Problem: [1,2,2,3]
Solution: 1
Explanation: The array is monotonic as 1 < 2 <= 2 < 3
Problem: [101, 93, 85, 77, 69, 61, 53]
Solution: | 1 | 4 | NIv2 | task1089_check_monotonic_array | fs_opt |
Given the task definition, example input & output, solve the new input case.
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
Example: [1,2,2,3]
Output: 1
The array is monotonic as 1 < 2 <= 2 < 3
New input case for you: [78, 26, 59, 51, 65, 86, 57, 47, 64, 91]
Output: | 2 | 1 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
Let me give you an example: [1,2,2,3]
The answer to this example can be: 1
Here is why: The array is monotonic as 1 < 2 <= 2 < 3
OK. solve this:
[27, 37, 47, 57, 67, 77, 87, 97, 107, 117, 127, 137, 147, 157, 167, 177]
Answer: | 1 | 8 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
[EX Q]: [19, 24, 29, 34, 39, 44, 49, 54, 59, 64, 69, 74, 79, 84, 89, 94, 99, 104, 109, 114, 119, 124, 129, 134, 139, 144]
[EX A]: 1
[EX Q]: [166, 162, 158, 154, 150, 146, 142, 138, 134, 130, 126, 122, 118, 114, 110, 106, 102, 98, 94, 90, 86, 82, 78, 74, 70, 66, 62, 58, 54, 50, 46, 42, 38, 34, 30, 26, 22, 18, 14]
[EX A]: 1
[EX Q]: [97, 74, 13, 1, 60, 79, 28, 53, 6, 44]
[EX A]: | 2
| 6 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
[EX Q]: [141, 139, 137, 135, 133, 131, 129, 127, 125, 123, 121, 119, 117, 115, 113, 111, 109, 107, 105, 103, 101, 99, 97, 95, 93, 91, 89, 87, 85, 83, 81, 79, 77, 75, 73, 71, 69, 67, 65, 63, 61, 59, 57, 55, 53, 51, 49, 47, 45, 43, 41, 39, 37, 35, 33, 31, 29, 27, 25, 23, 21, 19, 17, 15, 13, 11, 9, 7, 5]
[EX A]: 1
[EX Q]: [98, 33, 77, 20, 75, 1, 47, 0, 11, 5]
[EX A]: 2
[EX Q]: [34, 40, 46, 52, 58, 64, 70, 76, 82, 88, 94, 100, 106, 112, 118, 124, 130, 136, 142, 148, 154, 160, 166, 172, 178]
[EX A]: | 1
| 6 | NIv2 | task1089_check_monotonic_array | fs_opt |
Detailed Instructions: You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
See one example below:
Problem: [1,2,2,3]
Solution: 1
Explanation: The array is monotonic as 1 < 2 <= 2 < 3
Problem: [20, 86, 93, 13, 46, 97, 9, 61, 18, 78]
Solution: | 2 | 4 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
--------
Question: [41, 10, 1, 63, 24, 69, 71, 43, 37, 50]
Answer: 2
Question: [188, 187, 186, 185, 184, 183, 182, 181, 180, 179, 178, 177, 176, 175, 174, 173, 172, 171, 170, 169, 168, 167, 166, 165, 164, 163, 162, 161, 160, 159, 158, 157, 156, 155, 154, 153, 152, 151, 150, 149, 148, 147, 146, 145, 144, 143, 142, 141, 140, 139, 138, 137, 136, 135, 134, 133, 132, 131, 130, 129, 128, 127, 126, 125, 124, 123, 122, 121, 120, 119, 118, 117, 116, 115, 114, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24]
Answer: 1
Question: [19, 24, 29, 34, 39, 44, 49, 54, 59, 64, 69, 74, 79, 84, 89, 94, 99, 104, 109, 114, 119, 124, 129, 134, 139, 144]
Answer: | 1
| 7 | NIv2 | task1089_check_monotonic_array | fs_opt |
Part 1. Definition
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
Part 2. Example
[1,2,2,3]
Answer: 1
Explanation: The array is monotonic as 1 < 2 <= 2 < 3
Part 3. Exercise
[26, 65, 35, 76, 80, 18, 74, 19, 32, 78]
Answer: | 2 | 7 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
Ex Input:
[12, 40, 45, 65, 87, 43, 80, 67, 76, 56]
Ex Output:
2
Ex Input:
[4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, 84, 88, 92, 96, 100, 104, 108, 112, 116, 120]
Ex Output:
1
Ex Input:
[26, 65, 35, 76, 80, 18, 74, 19, 32, 78]
Ex Output:
| 2
| 1 | NIv2 | task1089_check_monotonic_array | fs_opt |
You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right
[EX Q]: [193, 184, 175, 166, 157, 148, 139, 130, 121, 112, 103, 94, 85, 76, 67, 58, 49, 40, 31, 22]
[EX A]: 1
[EX Q]: [43, 91, 52, 80, 67, 34, 10, 29, 11, 74]
[EX A]: 2
[EX Q]: [193, 184, 175, 166, 157, 148, 139, 130, 121, 112, 103, 94, 85, 76, 67, 58, 49, 40, 31, 22]
[EX A]: | 1
| 6 | NIv2 | task1089_check_monotonic_array | fs_opt |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 5