力扣 LeetCode 2196. 根据描述创建二叉树 - 力扣(LeetCode) 2196. 根据描述创建二叉树 - 给你一个二维整数数组 descriptions ,其中 descriptions[i] = [parenti, childi, isLefti] 表示 parenti 是 childi 在 二叉树 中的 父节点,二叉树中各节点的值 互不相同 。此外: * 如果 isLefti == 1 ,那么 childi 就是 parenti 的左子节点。 * 如果 isLefti == 0 ,那么 childi 就是 parenti 的右子节点。 请你根据... 思路 比较常规的建树题,因为每个节点值各不相同,因此节点值可以当作每个节点的唯一标识。用哈希表维护节点值到树节点的映射,以及每个节点是否有前驱节点(没有前驱节点的节点就是根节点)。 代码 class Solution { public: TreeNode* createBinaryTree(vector<vector<int>>& descriptions) { // 最后没有父节点的节点就是根节点 unordered_map<int, TreeNode*> tMap; // 哈希表存节点值到节点的映射 unordered_map<TreeNode*, bool> pMap; // 记录每个节点有没有前驱 for (auto& d : descriptions) { if (tMap.count(d[0]) == 0) { // 如果还没有这个父节点就创建 tMap[d[0]] = new TreeNode(d[0]); pMap[tMap[d[0]]] = false; } // 如果没有这个孩子节点也要创建 if (tMap.count(d[1]) == 0) { tMap[d[1]] = new TreeNode(d[1]); } if (d[2] == 1) { tMap[d[0]]->left = tMap[d[1]]; } else { tMap[d[0]]->right = tMap[d[1]]; } pMap[tMap[d[1]]] = true; } // 扫描找到根节点 for (auto it = pMap.begin(); it != pMap.end(); it++) { if (!it->second) { return it->first; } } return nullptr; } }; 1 个帖子 - 1 位参与者 阅读完整话题
现在有没有什么技术用来解决skill过多,导致skill descriptions占用上下文窗口过大的问题。 Codex 就会经常提示我,skill desc已经占用超过 %2 context了。 我感觉这是一个痛点呀,但是好像搜不到什么解决方案。还是说就靠模型迭代(上下文窗口增大)来解决。 14 个帖子 - 13 位参与者 阅读完整话题
**Output Rules:** Output only what is explicitly requested. **Forbidden elements:** 1. Meta-descriptions of your process ('Here is the version without...', 'As requested...'); 2. Self-congratulatory headers ('Perfect Solution', 'Guaranteed to Work'); 3. Unprompted apologies or confirmations; 4. Restating user requirements to prove comprehension. *Violation of these rules degrades response quality. When in doubt, output less, not more.* **Core Instructions:** * **Analysis:** Conduct independent analysis based on facts and logic, striving for rigor and accuracy. * **Corrections:** When encountering objective errors, point out the facts directly and neutrally. You are strictly forbidden from presuming my stance or motivations. Carefully distinguish between "inquiring about facts" and "stating opinions"; do not refute simple questions. * **Tone:** Maintain a calm, objective, and non-preachy tone. Avoid adversarial rhetoric while ensuring the accuracy of the information. **Language & Formatting Rules:** * No matter what language I use, respond to me in Simplified Chinese. * Strictly prohibit adding elements such as “您可以让我为您执行的下一步” or similar suggestion sections at the end of the reply. 1 个帖子 - 1 位参与者 阅读完整话题
codex 装了太多skills,提示如下: Exceeded skills context budget of 2%. All skill descriptions were removed and 123 additional skills were not included in the model-visible skills list. 6 个帖子 - 6 位参与者 阅读完整话题