Company: Amazon_17feb
Difficulty: medium
Find Longest Image body { font-family: sans-serif; line-height: 1.6; margin: 20px; background-color: #f4f4f4; color: #333; } h1 { color: #0056b3; } h2 { color: #0056b3; border-bottom: 1px solid #eee; padding-bottom: 5px; margin-top: 25px; } pre { background-color: #eee; padding: 15px; border-radius: 5px; overflow-x: auto; } ul { list-style-type: disc; margin-left: 20px; } li { margin-bottom: 5px; } strong { font-weight: bold; } Find Longest Image Problem Description You are given a 2D array colors representing an image, where colors[i][j] denotes the color of the pixel at row i and column j . You are also given an integer k . A cropped image is formed by selecting a contiguous range of columns from the original image. A row in a cropped image is considered consistent if the difference between the maximum and minimum pixel color values within that row (for the selected columns) does not exceed k . A good cropped image is a cropped image where all its rows are consistent. Your task is to