#腾讯音乐娱乐笔试#第一题:统计每个字符的次数c[s[i] - 'a']ans += c[s[i]-'a'] / 2;a = c[s[i] - 'a'] ^ 1;ans = (ans - 26 + a)第二题:针对每个可能的分割点进行分割,尝试构造二叉树,判断下边界条件。第三题://layers是层次节点,void goback(vector >& layers) { for (int i = layers.size() - 1;i >= 1;--i) { int n = layers[i].size(); for (int j = 0;j int lmax = layers[i][j]->left != nullptr? layers[i][j]->left->val + 1 : 1; int rmax = layers[i][j+1]->left != nullptr? layers[i][j+1]->left->val + 1: 1; layers[i][j]->val = max(lmax, rmax); layers[i][j+1]->val = max(lmax, rmax); } } if (layers[0][0]->left != nullptr) layers[0][0]->val = layers[0][0]->left->val + 1; else layers[0][0]->val = 1; }结果为2^(tree->val) - 1 % mod。此处用快速幂计算结果。问答题:100亿*1亿的表,,估计凉了