Given an array of comparable elements a[0..m-1] and an integer N:
-
Write a function that returns the maximum length of any run of consecutive equal elements in a.
-
Follow-up: return true if there exists a run whose length is at least N. Provide time and space complexities.
-
Follow-up: extend the design to support many online suffix-only queries: for each query index i, determine whether the suffix a[i..m-1] contains a run of length at least N. Describe preprocessing, data structures (e.g., prefix/suffix run lengths, segment tree, sparse table), and query/update complexities, and discuss trade-offs.