Skip to content

Commit 0ab915d

Browse files
committed
Chapter 04 codes comments updated.
1 parent efe362b commit 0ab915d

File tree

21 files changed

+66
-12
lines changed

21 files changed

+66
-12
lines changed

04-Using-Hash-Table/Course Code (C++)/01-Intersection-of-Two-Arrays/main.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
#include <iostream>
22
#include <vector>
33
#include <set>
4+
45
using namespace std;
56

6-
/// 349. Intersection of Two Arrays
7+
// 349. Intersection of Two Arrays
8+
// https://leetcode.com/problems/intersection-of-two-arrays/description/
9+
// 时间复杂度: O(nlogn)
10+
// 空间复杂度: O(n)
711
class Solution {
812
public:
913
vector<int> intersection(vector<int>& nums1, vector<int>& nums2) {

04-Using-Hash-Table/Course Code (C++)/01-Intersection-of-Two-Arrays/main2.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
#include <set>
44
using namespace std;
55

6-
/// 349. Intersection of Two Arrays
6+
// 349. Intersection of Two Arrays
7+
// https://leetcode.com/problems/intersection-of-two-arrays/description/
8+
// 时间复杂度: O(nlogn)
9+
// 空间复杂度: O(n)
710
class Solution {
811
public:
912
vector<int> intersection(vector<int>& nums1, vector<int>& nums2) {

04-Using-Hash-Table/Course Code (C++)/02-Intersection-of-Two-Arrays-II/main.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
#include <iostream>
22
#include <vector>
33
#include <map>
4+
45
using namespace std;
56

6-
/// 350. Intersection of Two Arrays II
7+
// 350. Intersection of Two Arrays II
8+
// https://leetcode.com/problems/intersection-of-two-arrays-ii/description/
9+
// 时间复杂度: O(nlogn)
10+
// 空间复杂度: O(n)
711
class Solution {
812
public:
913
vector<int> intersect(vector<int>& nums1, vector<int>& nums2) {

04-Using-Hash-Table/Course Code (C++)/02-Intersection-of-Two-Arrays-II/main2.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44

55
using namespace std;
66

7-
/// 350. Intersection of Two Arrays II
7+
// 350. Intersection of Two Arrays II
8+
// https://leetcode.com/problems/intersection-of-two-arrays-ii/description/
9+
// 时间复杂度: O(nlogn)
10+
// 空间复杂度: O(n)
811
class Solution {
912
public:
1013
vector<int> intersect(vector<int>& nums1, vector<int>& nums2) {

04-Using-Hash-Table/Course Code (C++)/02-Intersection-of-Two-Arrays-II/main3.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44

55
using namespace std;
66

7-
/// 350. Intersection of Two Arrays II
8-
/// Using multiset
7+
// 350. Intersection of Two Arrays II
8+
// https://leetcode.com/problems/intersection-of-two-arrays-ii/description/
9+
// 时间复杂度: O(nlogn)
10+
// 空间复杂度: O(n)
911
class Solution {
1012
public:
1113
vector<int> intersect(vector<int>& nums1, vector<int>& nums2) {

04-Using-Hash-Table/Course Code (C++)/03-More-About-Set-And-Map/main.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
#include <unordered_set>
44
using namespace std;
55

6-
/// 349. Intersection of Two Arrays
6+
// 349. Intersection of Two Arrays
7+
// https://leetcode.com/problems/intersection-of-two-arrays/description/
8+
// 时间复杂度: O(len(nums1)+len(nums2))
9+
// 空间复杂度: O(len(nums1))
710
class Solution {
811
public:
912
vector<int> intersection(vector<int>& nums1, vector<int>& nums2) {

04-Using-Hash-Table/Course Code (C++)/03-More-About-Set-And-Map/main2.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
#include <unordered_map>
44
using namespace std;
55

6-
/// 350. Intersection of Two Arrays II
6+
// 350. Intersection of Two Arrays II
7+
// https://leetcode.com/problems/intersection-of-two-arrays-ii/description/
8+
// 时间复杂度: O(len(nums1)+len(nums2))
9+
// 空间复杂度: O(len(nums1))
710
class Solution {
811
public:
912
vector<int> intersect(vector<int>& nums1, vector<int>& nums2) {

04-Using-Hash-Table/Course Code (C++)/04-Two-Sum/main.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
using namespace std;
77

8+
// 1. Two Sum
9+
// https://leetcode.com/problems/two-sum/description/
810
// 时间复杂度:O(n)
911
// 空间复杂度:O(n)
1012
class Solution {

04-Using-Hash-Table/Course Code (C++)/05-4Sum-II/main.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
using namespace std;
77

8+
// 454. 4Sum II
9+
// https://leetcode.com/problems/4sum-ii/description/
810
// 时间复杂度: O(n^2)
911
// 空间复杂度: O(n^2)
1012
class Solution {

04-Using-Hash-Table/Course Code (C++)/05-4Sum-II/main2.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
using namespace std;
88

9+
// 454. 4Sum II
10+
// https://leetcode.com/problems/4sum-ii/description/
911
// 时间复杂度: O(n^2)
1012
// 空间复杂度: O(n^2)
1113
class Solution {

0 commit comments

Comments
 (0)