Problem C
Swipe to start coding
Given an array arr
of integer values. Create the function isProgression()
to check if it is possible to present the values of arr
as arithmetic progression. It returns True
or False
. Call it for 3 arrays and print the results in the next order: arr1
, arr2
, arr3
.
Example 1
Input: arr
=[5, 7, 1, 3, -1]
Output: true. Rearrange elements like [-1, 1, 3, 5, 7] or [7, 5, 3, 1, -1].
Example 2
Input: arr
=[2, 4, 16]
Output: false.
Ratkaisu
Kiitos palautteestasi!
single
Kysy tekoälyä
Kysy tekoälyä
Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme
Tiivistä tämä luku
Explain code
Explain why doesn't solve task
Awesome!
Completion rate improved to 7.69
Problem C
Pyyhkäise näyttääksesi valikon
Swipe to start coding
Given an array arr
of integer values. Create the function isProgression()
to check if it is possible to present the values of arr
as arithmetic progression. It returns True
or False
. Call it for 3 arrays and print the results in the next order: arr1
, arr2
, arr3
.
Example 1
Input: arr
=[5, 7, 1, 3, -1]
Output: true. Rearrange elements like [-1, 1, 3, 5, 7] or [7, 5, 3, 1, -1].
Example 2
Input: arr
=[2, 4, 16]
Output: false.
Ratkaisu
Kiitos palautteestasi!
Awesome!
Completion rate improved to 7.69single