You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: C++/chapLinearList.tex
+71-1Lines changed: 71 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ \chapter{线性表}
5
5
\section{数组} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6
6
7
7
\subsection{Contains Duplicate}
8
-
\label{sec:containd_duplicate}
8
+
\label{sec:containd-duplicate}
9
9
10
10
11
11
\subsubsection{描述}
@@ -43,6 +43,76 @@ \subsubsection{相关题目}
43
43
\myenddot
44
44
45
45
46
+
\subsection{Contains Duplicate II}
47
+
\label{sec:containd-duplicate-ii}
48
+
49
+
50
+
\subsubsection{描述}
51
+
Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the difference between i and j is at most k.
52
+
53
+
\subsubsection{分析}
54
+
无
55
+
56
+
57
+
\subsubsection{代码1}
58
+
\begin{Code}
59
+
// LeetCode, Contains Duplicate
60
+
// 时间复杂度O(nlogn), 空间复杂度O(n)
61
+
62
+
class Solution {
63
+
public:
64
+
bool containsNearbyDuplicate(vector<int>& nums, int k) {
Given an array of integers, find out whether there are two distinct indices i and j in the array such that the difference between nums[i] and nums[j] is at most t and the difference between i and j is at most k.
0 commit comments