Complete the code to define a subclass of Array.
class MyArray < [1] end
The subclass MyArray inherits from Array using the < operator.
Complete the code to override the < operator to compare lengths.
class MyArray < Array def <(other) self.length [1] other.length end end
The < method compares the length of self with other using the < operator.
Fix the error in the method to correctly compare array lengths.
class MyArray < Array def <(other) self.size [1] other.size end end
The < method should use the < operator to compare sizes for correct behavior.
Fill both blanks to complete the subclass and define the < operator comparing sums.
class MyArray [1] Array def <(other) self.sum [2] other.sum end end
The subclass inherits from Array using <. The < method compares the sums using the <= operator.
Fill all three blanks to define a subclass with < operator comparing max values.
class MyArray [1] Array def <(other) self.max [2] other.max && self.min [3] other.min end end
The subclass inherits from Array using <. The < method compares max values with <= and min values with >=.