seam carver algorithm solution