7 kyu

Inertial Array

287 of 642aweleshetu

Description:

An array is defined to be inertialif the following conditions hold:

a. it contains at least one odd value  
b. the maximum value in the array is even 
c. every odd value is greater than every even value that is not the maximum value.

eg:-

So [11, 4, 20, 9, 2, 8] is inertial because 
a. it contains at least one odd value [11,9] 
b. the maximum value in the array is 20 which is even 
c. the two odd values (11 and 9) are greater than all the even values that are not equal to 20 (the maximum), i.e., [4, 2, 8]

Write a function called is_inertial that accepts an integer array and returns true if the array is inertial; otherwise it returns false.

Arrays
Fundamentals

Stats:

CreatedAug 26, 2017
PublishedAug 26, 2017
Warriors Trained1054
Total Skips20
Total Code Submissions6297
Total Times Completed642
JavaScript Completions300
C# Completions85
Python Completions287
Total Stars18
% of votes with a positive feedback rating88% of 213
Total "Very Satisfied" Votes169
Total "Somewhat Satisfied" Votes36
Total "Not Satisfied" Votes8
Total Rank Assessments20
Average Assessed Rank
6 kyu
Highest Assessed Rank
5 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • aweleshetu Avatar
  • Voile Avatar
  • Souzooka Avatar
  • KenKamau Avatar
  • hobovsky Avatar
Ad