The flatten!() is an inbuilt method in Ruby replaces the receiver with the result in place. Returns nil if no modifications were made.
Parameters: The function does not takes any parameter.
Return Value: It returns the receiver with the result in place, or else returns nil if no changes are made.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.