there are N pyramids in a line.you are given their Heights as a list of integers. write a program to print the minimum absolute difference between the heights of any two different pyramids.
def minimum_absolute_difference(heights: list):
sorted_heights = sorted(heights)
return min([sorted_heights[i] - sorted_heights[i - 1] for i in range(1, len(heights))])
Comments
Leave a comment