摘要:
/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */ cla... 阅读全文
摘要:
class Solution { public: vector path; unordered_map> m; vector findItinerary(vector> tickets) { for (auto &p : tickets) m[p.first].insert(p.second); dfs("JFK")... 阅读全文
摘要:
/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */ cla... 阅读全文
摘要:
class Solution { public: int calPoints(vector& ops) { vector v; for (auto &s : ops) { if (s == "+") { v.push_back(v[v.size()-1] + v[v.size()-2]); ... 阅读全文
摘要:
class Solution { public: string solveEquation(string equation) { int idx = equation.find('='); int x1 = 0, v1 = 0, x2 = 0, v2 = 0, idx1 = 0, idx2 = 0; helper(equa... 阅读全文