题目描述
NIO is playing a game about trees. The game has two trees A,BA, BA,B each with NNN vertices. The vertices in each tree are numbered from 111 to NNN and the iii-th vertex has the weight viv_ivi. The root of each tree is vertex 1. Given KKK key n…
力扣2781.最长合法子字符串的长度 将字符串数组存入哈希表 枚举所有右端点反向遍历子串在哈希表中找所有以i为右端点的字符串若找到相同子串 更新j k 1 class Solution {public:int longestValidSubstring(string word, vector<string>& forbidden) {unordered_…