https://leetcode.com/problems/merge-two-sorted-lists/ Solution Time Complexity: O(length(list1) + length(list2)) Space Complexity: O(1) class Solution { public: ListNode* mergeTwoLists(ListNode* list1 ...
https://leetcode.com/problems/intersection-of-two-arrays-ii/ Solution Time Complexity: O(len(nums1) + len(nums2)) Space Complexity: O(len(nums1) + len(nums2)) class Solution: def intersect(self, nums1 ...
https://leetcode.com/problems/isomorphic-strings/ Solution Time Complexity: O(s.length()) Space Complexity: O(s.length()) class Solution { public: bool isIsomorphic(string s, string t) { std::map<c ...
https://leetcode.com/problems/merge-sorted-array/ First Solution 從尾到頭逆著做回來 Time Complexity: O(m + n) Space Complexity: O(1) class Solution { public: void merge(vector& nums1, int m, vector& nu ...
Hash table in C++ 初始化 std::set<template> s; std::set<template> s{…}; template arr = {…}; std::set<template> s(arr, arr + {length of arr}); — std::map<template_ke ...
for(range_declaration : range_expression){ loop_statement } 範例 用 range based for loop 存取 vector for(int y : x)cout << y << " "; cout << endl;
C++ 中的 sum() template<class InputIt, class T> (constexpr) T accumulate(InputIt first, InputIt last, T init(, BinaryOperation op)); frist, last range 為 [first, last) init initial value op 預設為 plu ...
開新 screen screen [-S {screen_name}] 顯示目前執行中的所有 screen screen -ls 復原至指定 screen screen -r {screen_id} 結束screen 結束目前所在 screen exit 結束所有 screen pkill screen
vi/vim nano
確認命令來源 type pythonX type -a pythonX (查 alias(別名)) 用 update-alternatives 切換 安裝自定選項 sudo update-alternatives --install /usr/bin/pythonX pythonX /usr/bin/pythonX.Y 300 ※ 300為優先度,數值越高優先度越高 查看 update-alter ...