This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| kwriteconfig6 --file kioslaverc --group 'Proxy Settings' --key ProxyType "1" | |
| kwriteconfig6 --file kioslaverc --group 'Proxy Settings' --key 'httpProxy' 'http://127.0.0.1:10081' | |
| kwriteconfig6 --file kioslaverc --group 'Proxy Settings' --key 'httpsProxy' 'http://127.0.0.1:10081' | |
| kwriteconfig6 --file kioslaverc --group 'Proxy Settings' --key 'ftpProxy' 'http://127.0.0.1:10081' | |
| kwriteconfig6 --file kioslaverc --group 'Proxy Settings' --key Authmode 0 | |
| # When you modify kioslaverc, you need to tell KIO. | |
| dbus-send --type=signal /KIO/Scheduler org.kde.KIO.Scheduler.reparseSlaveConfiguration string:'' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Solution: | |
| def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float: | |
| l1 = len(nums1) | |
| l2 = len(nums2) | |
| total_len = 0 | |
| index1 = 0 | |
| index2 = 0 | |
| last1 = 0 | |
| last2 = 0 | |
| while True: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def merge_sort(arr): | |
| if len(arr) > 1: | |
| mid = len(arr) // 2 # Finding the mid of the array | |
| L = arr[:mid] # Dividing the elements into 2 halves | |
| R = arr[mid:] | |
| merge_sort(L) # Sorting the first half | |
| merge_sort(R) # Sorting the second half |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def quick_sort_iterative(arr): | |
| stack = [(0, len(arr) - 1)] # 定义一个栈,用于存储待排序的区间 | |
| while stack: | |
| start, end = stack.pop() # 从栈中弹出一个区间 | |
| if start >= end: | |
| continue | |
| pivot = arr[end] # 选择最后一个元素作为枢轴 | |
| partition_index = start # 分区的索引 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <cstddef> | |
| #include <iostream> | |
| using namespace std; | |
| struct ListNode { | |
| int val; | |
| ListNode *next; | |
| ListNode() : val(0), next(nullptr) {} | |
| ListNode(int x) : val(x), next(nullptr) {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| // nested way | |
| struct ListNode { | |
| int val; | |
| ListNode *next; | |
| ListNode() : val(0), next(nullptr) {} | |
| ListNode(int x) : val(x), next(nullptr) {} | |
| ListNode(int x, ListNode *next) : val(x), next(next) {} | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| using namespace std; | |
| long long factorial(int n) { | |
| if (n == 0 || n == 1) { | |
| return 1; | |
| } | |
| long long result = 1; | |
| for (int i = 2; i <= n; ++i) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <algorithm> | |
| #include <climits> | |
| #include <cmath> | |
| #include <cstddef> | |
| #include <iostream> | |
| #include <type_traits> | |
| #include <vector> | |
| using namespace std; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <vector> | |
| int main() { | |
| std::vector<int> vec = {1, 2, 3, 4, 5}; | |
| // 获取最后一个元素 | |
| int last_element = vec.back(); | |
| std::cout << "Last element: " << last_element << std::endl; // 输出 5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <algorithm> | |
| #include <climits> | |
| #include <cmath> | |
| #include <cstddef> | |
| #include <cstdio> | |
| #include <filesystem> | |
| #include <iostream> | |
| #include <vector> | |
| using namespace std; |