Brush title suffix array summary

T1: Sandy card

When solving the problem of $ height [] $ understanding is not profound, leading to a night out This question is not $ A $

Clearly the difference as an array of characters, to link up the process a $ height [] $

After two minutes, an open stack recording element memory arise, as long as the number of elements greater than or equal to $ $ n-determined legitimate

T2: meow named on the planet

Continuation of the routine of a question, ask the name and even as a string

After the two separated about a contribution can do for the beginning of each interval of inquiry

Now the number of different colors into question m intervals, each interval and find the number of occurrences of each color

Mo can be used to solve the team

(However, half finished directly storms sweep can be $ AC $)

T3: string

 Do so directly before a string of limited length, taking half of the answer to eliminate restrictions

After you can find if there is $ [a, b-len + 1] interval query interval to contribute $ answers

It is the board chairman of the tree

(This question is legitimate direct sweep range can be $ 7000ms + $ faster than the Chairman of the tree)

T4: Differences

 The idea is very simple, find the minimum value for each $ height $ interval to calculate the answer

T5: Similar substring

First, it must be a substring suffix prefix

Therefore height $ [] $ handle after processing corresponding to the sorted sequence also

Direct-half will be able to find the rankings for the substring i

Direct Access first question, and then ask the second-half the length of the investigation, no need to turn the string with a hash or

T6: Assembly tasting

After four misunderstood the meaning of problems or suffering a $ AC $

The best idea is to think hard check during maintenance updates largest (small) times large (small) value each time interval merger

But the findings do not need to maintain the second largest (small) value, just put in the maximum * Maximum two intervals, the answer to the smallest minimum update *

Other cases must be counted over the interval when the original merger

Note solve the first question when $ height [1] $ is not directly contribute to it should be skipped

T7: Alien Contact

While on the suffix array (two) years, but the board is indeed a problem

For each suffix, only statistics $ [h [i-1] + 1, h [i]] $ appeared many times in the back

Plus 2 is the answer

Guess you like

Origin www.cnblogs.com/AthosD/p/12088542.html