Skip to content

Commit 0460324

Browse files
author
liwentian
committed
fd
1 parent 3af1589 commit 0460324

File tree

6 files changed

+51
-7
lines changed

6 files changed

+51
-7
lines changed

ebook/Backtracking.aux

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@
1616
\@writefile{lof}{\contentsline {figure}{\numberline {图\nobreakspace 1-1}{ \ignorespaces Phone Keyboard}}{3}{section*.5}}
1717
\newlabel{fig:phone-keyboard}{{1-1}{3}{Description}{section*.5}{}}
1818
\@writefile{toc}{\contentsline {subsubsection}{Solution}{3}{section*.6}}
19+
\@writefile{toc}{\contentsline {section}{\numberline {1.4}Generate Parentheses}{5}{section.1.4}}
20+
\@writefile{toc}{\contentsline {subsubsection}{Description}{5}{section*.7}}
21+
\@writefile{toc}{\contentsline {subsubsection}{Solution}{5}{section*.8}}
1922
\FN@pp@footnotehinttrue
2023
\@setckpt{Backtracking}{
21-
\setcounter{page}{5}
24+
\setcounter{page}{6}
2225
\setcounter{equation}{0}
2326
\setcounter{enumi}{0}
2427
\setcounter{enumii}{0}
@@ -28,20 +31,20 @@
2831
\setcounter{mpfootnote}{0}
2932
\setcounter{part}{0}
3033
\setcounter{chapter}{1}
31-
\setcounter{section}{3}
34+
\setcounter{section}{4}
3235
\setcounter{subsection}{0}
3336
\setcounter{subsubsection}{0}
3437
\setcounter{paragraph}{0}
3538
\setcounter{subparagraph}{0}
3639
\setcounter{figure}{1}
3740
\setcounter{table}{0}
38-
\setcounter{FancyVerbLine}{46}
41+
\setcounter{FancyVerbLine}{17}
3942
\setcounter{pp@next@reset}{1}
4043
\setcounter{@fnserial}{0}
4144
\setcounter{Item}{0}
4245
\setcounter{Hfootnote}{0}
4346
\setcounter{Hy@AnnotLevel}{0}
44-
\setcounter{bookmark@seq@number}{4}
47+
\setcounter{bookmark@seq@number}{5}
4548
\setcounter{parentequation}{0}
4649
\setcounter{section@level}{3}
4750
}

ebook/Backtracking.tex

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,4 +159,44 @@ \subsubsection{Solution}
159159
}
160160
return queue;
161161
}
162+
\end{Code}
163+
164+
\newpage
165+
166+
\section{Generate Parentheses}
167+
168+
\subsubsection{Description}
169+
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.
170+
171+
For example, given \code{n = 3}, a solution set is:
172+
\begin{Code}
173+
[
174+
"((()))",
175+
"(()())",
176+
"(())()",
177+
"()(())",
178+
"()()()"
179+
]
180+
\end{Code}
181+
182+
\subsubsection{Solution}
183+
184+
\begin{Code}
185+
public List<String> generateParenthesis(int n) {
186+
List<String> result = new LinkedList<String>();
187+
dfs(result, n, "", 0, 0);
188+
return result;
189+
}
190+
191+
private void dfs(List<String> result, int n, String str, int left, int right) {
192+
if (left == n && right == n) {
193+
result.add(str);
194+
return;
195+
}
196+
if (left > n || right > n || left < right) {
197+
return;
198+
}
199+
dfs(result, n, str + "(", left + 1, right);
200+
dfs(result, n, str + ")", left, right + 1);
201+
}
162202
\end{Code}

ebook/leetcode.log

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
This is XeTeX, Version 3.14159265-2.6-0.99996 (TeX Live 2016) (preloaded format=xelatex 2017.9.4) 5 SEP 2017 11:06
1+
This is XeTeX, Version 3.14159265-2.6-0.99996 (TeX Live 2016) (preloaded format=xelatex 2017.9.4) 5 SEP 2017 11:13
22
entering extended mode
33
restricted \write18 enabled.
44
%&-line parsing enabled.
@@ -1906,7 +1906,7 @@ File: images/phone.png Graphic file (type QTm)
19061906
. with NFSS spec.: <->"Latin Modern Mono/BI/OT:script=latn;language=DFLT;"
19071907
. - 'bold italic small caps' (bx/itsc) with NFSS spec.:
19081908
.................................................
1909-
[3]) [4]
1909+
[3] [4]) [5]
19101910
No file leetcode.ind.
19111911
Package atveryend Info: Empty hook `BeforeClearDocument' on input line 42.
19121912
Package atveryend Info: Empty hook `AfterLastShipout' on input line 42.
@@ -1924,4 +1924,4 @@ Here is how much of TeX's memory you used:
19241924
1347 hyphenation exceptions out of 8191
19251925
65i,11n,77p,10414b,588s stack positions out of 5000i,500n,10000p,200000b,80000s
19261926

1927-
Output written on leetcode.pdf (4 pages).
1927+
Output written on leetcode.pdf (5 pages).

ebook/leetcode.out

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
\BOOKMARK [1][-]{section.1.1}{\376\377\0001\000.\0001\000\040\000R\000e\000g\000u\000l\000a\000r\000\040\000E\000x\000p\000r\000e\000s\000s\000i\000o\000n\000\040\000M\000a\000t\000c\000h\000i\000n\000g}{chapter.1}% 2
33
\BOOKMARK [1][-]{section.1.2}{\376\377\0001\000.\0002\000\040\000W\000i\000l\000d\000c\000a\000r\000d\000\040\000M\000a\000t\000c\000h\000i\000n\000g}{chapter.1}% 3
44
\BOOKMARK [1][-]{section.1.3}{\376\377\0001\000.\0003\000\040\000L\000e\000t\000t\000e\000r\000\040\000C\000o\000m\000b\000i\000n\000a\000t\000i\000o\000n\000s\000\040\000o\000f\000\040\000a\000\040\000P\000h\000o\000n\000e\000\040\000N\000u\000m\000b\000e\000r}{chapter.1}% 4
5+
\BOOKMARK [1][-]{section.1.4}{\376\377\0001\000.\0004\000\040\000G\000e\000n\000e\000r\000a\000t\000e\000\040\000P\000a\000r\000e\000n\000t\000h\000e\000s\000e\000s}{chapter.1}% 5

ebook/leetcode.pdf

2.27 KB
Binary file not shown.

ebook/leetcode.synctex.gz

2.01 KB
Binary file not shown.

0 commit comments

Comments
 (0)