def main
(args
: Array
[String
]): Unit
= { val a
= Array
(0,
2,
5,
7,
3,
1,
5,
7,
3,
2,
3) val result
= a.
zipWithIndex .groupBy(_._1)
.toList
.map(_._2.map(_._2))
.map(indices => indices.max - indices.min)
.+:(0)
.max
println(result)
}
}
b2JqZWN0IE1haW4gewogIGRlZiBtYWluKGFyZ3M6IEFycmF5W1N0cmluZ10pOiBVbml0ID0gewogICAgdmFsIGEgPSBBcnJheSgwLCAyLCA1LCA3LCAzLCAxLCA1LCA3LCAzLCAyLCAzKQogICAgdmFsIHJlc3VsdCA9IGEuemlwV2l0aEluZGV4CiAgICAgIC5ncm91cEJ5KF8uXzEpCiAgICAgIC50b0xpc3QKICAgICAgLm1hcChfLl8yLm1hcChfLl8yKSkKICAgICAgLm1hcChpbmRpY2VzID0+IGluZGljZXMubWF4IC0gaW5kaWNlcy5taW4pCiAgICAgIC4rOigwKQogICAgICAubWF4CiAgICBwcmludGxuKHJlc3VsdCkKICB9Cn0K