摘要:
字典树+dfs就完事了 class Solution { public: int tree[10010][26]; bool vis[10010]; int cnt; vector<string> v; void build(string str) { int len = str.length(); 阅读全文
摘要:
1 - n p = 1, q = n 奇数次选q, q++; 偶数次选p, p--; 直到选了k个数,此时相邻差的绝对值不同个数为k - 1 那么接下来该选的数,将按照上次选的方向直接选就行,也就是剩下的差的绝对值都为1 class Solution { public: vector<int> co 阅读全文