/* 自定義代碼塊樣式 */

herrDeng網內搜尋

自訂搜尋

Ads

2026年3月28日 星期六

C++UnionFind與matrix分析解難題Leetcode 2573 Find the String with LCP


解難題Leetcode 2573. Find the String with LCP,其實重點是lcp非常特殊的矩陣,只要搞定lcp各項的關聯,如對稱性,對角線上值-1等特性,應該能解出。會先用Union-Find主要是其解法可針對更為廣義的題目,要快就用貪婪。

1. UnionFind演算法適用於找出分量及其個數。
2. 字串的構造遵循貪婪算法。
3. 檢查定理中所述的矩陣條件。
-----
1. UnionFind is good to find the compoents & number of component
2. Construction of the string s follows the greedy principle
3. check the matrix conditions stated in Theorem

沒有留言:

Related Posts Plugin for WordPress, Blogger...

熱門文章