you give integer array roll length n integer k you roll k sided dice number 1 k n time result ith roll rollsireturn length short sequence roll take rollsA sequence roll length len result roll k sided dice len timesNote sequence take consecutive long order example 1input roll 421233241 k 4Output 3explanation every sequence roll length 1 1 2 3 4 take rollsevery sequence roll length 2 1 1 1 2 4 4 take rollsThe sequence 1 4 2 take roll return 3note sequence take rollsexample 2input roll 1122 k 2output 2explanation every sequence roll length 1 1 2 take rollsThe sequence 2 1 take roll return 2note sequence take roll 2 1 shortestExample 3input roll 11322233 k 4output 1explanation the sequence 4 take roll return 1note sequence take roll 4 short Constraintsn rollslength1 n 1051 rollsi k 105