1class Solution {2 public int maxDistance(int[] colors) {3 int l = 0, r = colors.length - 1;4 while (colors[colors.length - 1] == colors[l]) l++;5 while (colors[0] == colors[r]) r--;6 return Math.max(r, colors.length - 1 - l);7 }8}
WPM •0 •0
ACC •0 •0
TIME •0