(C-x means ctrl+x, M-x means alt+x)
The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:
| /** | |
| * Definition for a binary tree node. | |
| * struct TreeNode { | |
| * int val; | |
| * TreeNode *left; | |
| * TreeNode *right; | |
| * TreeNode() : val(0), left(nullptr), right(nullptr) {} | |
| * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} | |
| * TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {} | |
| * }; |
| /** | |
| * Definition for a binary tree node. | |
| * struct TreeNode { | |
| * int val; | |
| * TreeNode *left; | |
| * TreeNode *right; | |
| * TreeNode(int x) : val(x), left(NULL), right(NULL) {} | |
| * }; | |
| */ | |
| class Solution { |
| class Solution { | |
| public: | |
| int nthUglyNumber(int n) { | |
| std::vector<int> result; | |
| result.push_back(1); | |
| int p2 = 0; | |
| int p3 = 0; | |
| int p5 = 0; | |
| while (result.size() < n) { | |
| int x = std::min({result[p2] * 2, result[p3] * 3, result[p5] * 5}); |
| int lowbit(int x) { | |
| return x & (-x); | |
| } | |
| class Solution { | |
| public: | |
| vector<int> singleNumbers(vector<int>& nums) { | |
| int x = 0; | |
| for (auto n : nums) { | |
| x ^= n; |
| /** | |
| * Definition for a binary tree node. | |
| * struct TreeNode { | |
| * int val; | |
| * TreeNode *left; | |
| * TreeNode *right; | |
| * TreeNode() : val(0), left(nullptr), right(nullptr) {} | |
| * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} | |
| * TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {} | |
| * }; |
| struct Node { | |
| Node* children[26]; | |
| int flag; | |
| Node() { | |
| memset(children, 0, sizeof(children)); | |
| flag = 0; | |
| } | |
| }; |
| class Solution { | |
| public: | |
| vector<int> sortArrayByParity(vector<int>& A) { | |
| int back = A.size() - 1; | |
| for (int i = 0; i < back; ++i) { | |
| if (A[i] % 2 == 1) { | |
| std::swap(A[back], A[i]); | |
| back--; | |
| i--; | |
| } |
| class Solution { | |
| public: | |
| vector<int> distributeCandies(int candies, int num_people) { | |
| vector<int> v(num_people, 0); | |
| int round = 0; | |
| int s = (1 + num_people) * num_people / 2; | |
| int s_all = s; | |
| while (candies > s_all) { | |
| round++; | |
| s += num_people * num_people; |
| class Solution { | |
| public: | |
| int eraseOverlapIntervals(vector<vector<int>>& intervals) { | |
| if (intervals.empty()) { | |
| return 0; | |
| } | |
| sort(intervals.begin(), intervals.end(), [](auto&& a, auto&& b){ | |
| return a[1] == b[1] ? a[0] > b[0] : a[1] < b[1]; | |
| }); | |
| int left = 0; |