Skip to content

Commit 487c373

Browse files
committed
today update and details md
1 parent 9bf6023 commit 487c373

File tree

2 files changed

+297
-0
lines changed

2 files changed

+297
-0
lines changed

Details.md

+201
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
## Details
2+
## Array
3+
|Number| Title(Blog URL)|
4+
|------|-------|
5+
35 |[Search Insert Position](http://blog.csdn.net/daigualu/article/details/66995617)
6+
118| [Pascal's Triangle](http://blog.csdn.net/daigualu/article/details/67006388)
7+
119 |[Pascal's Triangle II](http://blog.csdn.net/daigualu/article/details/67069088)
8+
414| [Third Maximum Number](http://blog.csdn.net/daigualu/article/details/68063481)
9+
121| [Best Time to Buy and Sell Stock](http://blog.csdn.net/daigualu/article/details/71038726)
10+
66| [Plus One](http://blog.csdn.net/daigualu/article/details/71056697)
11+
26 |[Remove Duplicates from Sorted Array](http://blog.csdn.net/daigualu/article/details/71064545)
12+
27| [Remove Element](http://blog.csdn.net/daigualu/article/details/71104482)
13+
122 |[Best Time to Buy and Sell Stock II](http://blog.csdn.net/daigualu/article/details/71104584)
14+
268 |[Missing Number](http://blog.csdn.net/daigualu/article/details/69220202)
15+
217| [Contains Duplicate](http://blog.csdn.net/daigualu/article/details/71123673)
16+
532| [K-diff Pairs in an Array](http://blog.csdn.net/daigualu/article/details/71129806)
17+
189| [Rotate Array](http://blog.csdn.net/daigualu/article/details/71159419)
18+
169 |[Majority Element](http://blog.csdn.net/daigualu/article/details/69937729)
19+
167 |[Two Sum II - Input array is sorted](http://blog.csdn.net/daigualu/article/details/69787679)
20+
88 |[Merge Sorted Array](http://blog.csdn.net/daigualu/article/details/69367334)
21+
53 |[Maximum Subarray](http://blog.csdn.net/daigualu/article/details/69936974)
22+
485 |[Max Consecutive Ones](http://blog.csdn.net/daigualu/article/details/71216338)
23+
283 |[Move Zeroes](http://blog.csdn.net/daigualu/article/details/69329038)
24+
448 |[Find All Numbers Disappeared in an Array](http://blog.csdn.net/daigualu/article/details/71168875)
25+
1| [Two Sum](http://blog.csdn.net/daigualu/article/details/68957096)
26+
219 |[Contains Duplicate II](http://blog.csdn.net/daigualu/article/details/71166985)
27+
566| [Reshape the Matrix](http://blog.csdn.net/daigualu/article/details/71275325)
28+
561| [Array Partition I](http://blog.csdn.net/daigualu/article/details/71273279)
29+
30+
---
31+
32+
## Hash Table
33+
|Number| Title(Blog URL)|
34+
|------|-------|
35+
136 |[Single number](http://blog.csdn.net/daigualu/article/details/68921131)
36+
1| [Two Sum](http://blog.csdn.net/daigualu/article/details/68957096)
37+
447 |[Number of Boomerangs](http://blog.csdn.net/daigualu/article/details/68958818)
38+
463 |[Island Perimeter](http://blog.csdn.net/daigualu/article/details/68959304)
39+
409 |[Longest Palindrome](http://blog.csdn.net/daigualu/article/details/69053267)
40+
438 |[Find All Anagrams in a String](http://blog.csdn.net/daigualu/article/details/71339879)
41+
389 |[Find the Difference](http://blog.csdn.net/daigualu/article/details/71450823)
42+
350 |[Intersection of Two Arrays II](http://blog.csdn.net/daigualu/article/details/69666351)
43+
349 | [Intersection of Two Arrays](http://blog.csdn.net/daigualu/article/details/69666198)
44+
500 |[Keyboard Row](http://blog.csdn.net/daigualu/article/details/71447614)
45+
217| [Contains Duplicate](http://blog.csdn.net/daigualu/article/details/71123673)
46+
204 | [Count Primes](http://blog.csdn.net/daigualu/article/details/71366483)
47+
202 | [Happy Number](http://blog.csdn.net/daigualu/article/details/71433906)
48+
219 |[Contains Duplicate II](http://blog.csdn.net/daigualu/article/details/71166985)
49+
242 |[Valid Anagram](http://blog.csdn.net/daigualu/article/details/71358552)
50+
290 |[Word Pattern](http://blog.csdn.net/daigualu/article/details/71358552)
51+
205 |[Isomorphic Strings](http://blog.csdn.net/daigualu/article/details/71357419)
52+
53+
## Linked List
54+
|Number| Title(Blog URL)|
55+
|------|-------|
56+
141 | [Linked List Cycle](http://blog.csdn.net/daigualu/article/details/69055927)
57+
237 | [Delete Node in a Linked List](http://blog.csdn.net/daigualu/article/details/69055991)
58+
83 | [Remove Duplicates from Sorted List](http://blog.csdn.net/daigualu/article/details/69093677)
59+
160 | [Intersection of Two Linked Lists](http://blog.csdn.net/daigualu/article/details/69526717)
60+
203 |[Remove Linked List Elements](http://blog.csdn.net/daigualu/article/details/69389243)
61+
206 | [Reverse Linked List](http://blog.csdn.net/daigualu/article/details/69372119)
62+
234 | [Palindrome Linked List](http://blog.csdn.net/daigualu/article/details/69388513)
63+
21 | [Merge Two Sorted Lists](http://blog.csdn.net/daigualu/article/details/69565969)
64+
65+
---
66+
67+
## Math
68+
|Number| Title(Blog URL)|
69+
|------|-------|
70+
231 | [Power of Two](http://blog.csdn.net/daigualu/article/details/69102931)
71+
268| [Missing Number](http://blog.csdn.net/daigualu/article/details/69220202)
72+
507 | [Perfect Number](http://blog.csdn.net/daigualu/article/details/69233798)
73+
9| [Palindrome Number](http://blog.csdn.net/daigualu/article/details/72717009)
74+
453 | [Minimum Moves to Equal Array Elements](http://blog.csdn.net/daigualu/article/details/72354061)
75+
13 |Roman to Integer
76+
441 |[Arranging Coins]()
77+
415| [Add Strings](http://blog.csdn.net/daigualu/article/details/72356377)
78+
400 |[Nth Digit](http://blog.csdn.net/daigualu/article/details/72572244)
79+
367 |Valid Perfect Square
80+
66| [Plus One](http://blog.csdn.net/daigualu/article/details/71056697)
81+
7| [Reverse Integer](http://blog.csdn.net/daigualu/article/details/72464418)
82+
204 |[Count Primes](http://blog.csdn.net/daigualu/article/details/71366483)
83+
202 |[Happy Number](http://blog.csdn.net/daigualu/article/details/71433906)
84+
172 |Factorial Trailing Zeroes
85+
171 |[Excel Sheet Column Number](http://blog.csdn.net/daigualu/article/details/72717145)
86+
168 |[Excel Sheet Column Title](http://blog.csdn.net/daigualu/article/details/72638706)
87+
258 |Add Digits
88+
263 |Ugly Number
89+
69| [Sqrt(x)](http://blog.csdn.net/daigualu/article/details/72578272)
90+
67 |[Add Binary](http://blog.csdn.net/daigualu/article/details/72638937)
91+
246 |Strobogrammatic Number
92+
326 |Power of Three
93+
94+
---
95+
96+
## Two Pointers
97+
|Number| Title(Blog URL)|
98+
|------|-------|
99+
345 |[Reverse Vowels of a String](http://blog.csdn.net/daigualu/article/details/69257693)
100+
125 |[Valid Palindrome](http://blog.csdn.net/daigualu/article/details/69265381)
101+
283| [Move Zeroes](http://blog.csdn.net/daigualu/article/details/69329038)
102+
88 |[Merge Sorted Array](http://blog.csdn.net/daigualu/article/details/69367334)
103+
234| [Palindrome Linked List](http://blog.csdn.net/daigualu/article/details/69388513)
104+
349 |Intersection of Two Arrays
105+
167 |[Two Sum II - Input array is sorted](http://blog.csdn.net/daigualu/article/details/69787679)
106+
350| Intersection of Two Arrays II
107+
344| Reverse String
108+
28| Implement strStr()
109+
27 |Remove Element
110+
26| Remove Duplicates from Sorted Array
111+
141| Linked List Cycle
112+
532| K-diff Pairs in an Array
113+
114+
---
115+
116+
## String
117+
|Number| Title(Blog URL)|
118+
|------|-------|
119+
58| [Length of Last Word](http://blog.csdn.net/daigualu/article/details/69568460)| 31.5%| Easy
120+
20 |[Valid Parentheses](http://blog.csdn.net/daigualu/article/details/69569622) |32.8% |Easy
121+
520 |[Detect Capital](http://blog.csdn.net/daigualu/article/details/69663210)| 52.5%| Easy
122+
459 |[Repeated Substring Pattern](http://blog.csdn.net/daigualu/article/details/69663545)| 38.4%| Easy
123+
434 |[Number of Segments in a String](http://blog.csdn.net/daigualu/article/details/69664369) |37.0% |Easy
124+
408 |Valid Word Abbreviation | 27.5% |Easy
125+
13 |Roman to Integer |44.6%| Easy
126+
14 |[Longest Common Prefix](http://blog.csdn.net/daigualu/article/details/69665015) |31.0% |Easy
127+
383 |[Ransom Note](http://blog.csdn.net/daigualu/article/details/69665190) |46.5% |Easy
128+
521 |Longest Uncommon Subsequence I |46.1% |Easy
129+
345 |Reverse Vowels of a String| 37.9% |Easy
130+
28 |Implement strStr() |27.5% |Easy
131+
344 |Reverse String| 58.2%| Easy
132+
293 |Flip Game |54.8% |Easy
133+
38 |Count and Say |33.4% |Easy
134+
157 |Read N Characters Given Read4 | 29.2%| Easy
135+
541 |Reverse String II |44.1% |Easy
136+
125 |Valid Palindrome |25.8% |Easy
137+
67 |Add Binary |31.3% |Easy
138+
139+
---
140+
141+
## Stack
142+
|Number| Title(Blog URL)| Pass Rate| Degree |
143+
|------|----------------|--------|----------|
144+
225|[Implement Stack using Queues](http://blog.csdn.net/daigualu/article/details/70183272)| 32.0%| Easy
145+
496| [Next Greater Element I](http://blog.csdn.net/daigualu/article/details/70185529) |57.5% |Easy
146+
155| [Min Stack](http://blog.csdn.net/daigualu/article/details/70185814)| 27.4%| Easy
147+
232| [Implement Queue using Stacks](http://blog.csdn.net/daigualu/article/details/70186010)| 35.8%| Easy
148+
20| [Valid Parentheses](http://blog.csdn.net/daigualu/article/details/69569622)| 32.9%| Easy
149+
150+
---
151+
152+
## Binary Search
153+
|Number| Title(Blog URL)| Pass Rate| Degree |
154+
|------|----------------|--------|----------|
155+
367 |[Valid Perfect Square](http://blog.csdn.net/daigualu/article/details/69787644)| 37.8%| Easy
156+
270| Closest Binary Search Tree Value| 38.8%| Easy
157+
167 |[Two Sum II - Input array is sorted](http://blog.csdn.net/daigualu/article/details/69787679) |47.4%| Easy
158+
441 |[Arranging Coins](http://blog.csdn.net/daigualu/article/details/69788500)| 36.0%| Easy
159+
35| [Search Insert Position](http://blog.csdn.net/daigualu/article/details/66995617)| 39.3%| Easy
160+
374 |Guess Number Higher or Lower |34.4%| Easy
161+
69 |Sqrt(x) |27.4%| Easy|
162+
278| [First Bad Version](http://blog.csdn.net/daigualu/article/details/69802371) |24.8% |Easy
163+
475| Heaters |29.7%| Easy
164+
350 |[Intersection of Two Arrays II](http://blog.csdn.net/daigualu/article/details/69666351) |44.1%| Easy
165+
349| [Intersection of Two Arrays](http://blog.csdn.net/daigualu/article/details/69666198)| 46.5%| Easy
166+
167+
---
168+
169+
## Dynamic Programming
170+
|Number| Title(Blog URL)| Pass Rate| Degree |
171+
|------|----------------|--------|----------|
172+
53| [Maximum Subarray](http://blog.csdn.net/daigualu/article/details/69936974)| 39.2%| Easy|
173+
169| [Majority Element](http://blog.csdn.net/daigualu/article/details/69937729)| 45.6%| Easy|
174+
303| [Range Sum Query - Immutable](http://blog.csdn.net/daigualu/article/details/69938986)| 27.8%| Easy|
175+
276 |Paint Fence | 34.1%| Easy|
176+
523 |[Continuous Subarray Sum](http://blog.csdn.net/daigualu/article/details/69941770)| 21.6%| Easy|
177+
256| Paint House | 45.9%| Easy|
178+
198| [House Robber](http://blog.csdn.net/daigualu/article/details/69946684)| 38.1%| Easy|
179+
121| Best Time to Buy and Sell Stock|40.1% |Easy|
180+
70| Climbing Stairs |39.2%| Easy|
181+
182+
---
183+
184+
## Tree
185+
|Number| Title(Blog URL)| Pass Rate| Degree |
186+
|------|----------------|--------|----------|
187+
107| [Binary Tree Level Order Traversal II](http://blog.csdn.net/daigualu/article/details/70254459)| 39.0%| Easy
188+
257 |[Binary Tree Paths](http://blog.csdn.net/daigualu/article/details/70340125)| 36.8%| Easy
189+
501 |[Find Mode in Binary Search Tree](http://blog.csdn.net/daigualu/article/details/70341143)| 38.4%| Easy
190+
437 |[Path Sum III](http://blog.csdn.net/daigualu/article/details/70342773)| 39.3% |Easy
191+
404 |[Sum of Left Leaves](http://blog.csdn.net/daigualu/article/details/70482270)| 46.5%| Easy
192+
112 |[Path Sum](http://blog.csdn.net/daigualu/article/details/70482285)| 33.5% |Easy
193+
110 |[Balanced Binary Tree](http://blog.csdn.net/daigualu/article/details/70482667)| 36.8% |Easy
194+
108 |[Convert Sorted Array to Binary Search Tree](http://blog.csdn.net/daigualu/article/details/70485834)| 41.3%| Easy
195+
543 |[Diameter of Binary Tree](http://blog.csdn.net/daigualu/article/details/70491447)| 42.3%| Easy
196+
226 |[Invert Binary Tree](http://blog.csdn.net/daigualu/article/details/70536685)| 50.8%| Easy
197+
235 |[Lowest Common Ancestor of a Binary Search Tree](http://blog.csdn.net/daigualu/article/details/70539096)| 38.5%| Easy
198+
104 |[Maximum Depth of Binary Tree](http://blog.csdn.net/daigualu/article/details/70541420)| 51.7%| Easy
199+
111| [Minimum Depth of Binary Tree](http://blog.csdn.net/daigualu/article/details/70543969)| 32.7% |Easy
200+
101 |[Symmetric Tree](http://blog.csdn.net/daigualu/article/details/70544774)| 37.9%| Easy
201+
100| [Same Tree](http://blog.csdn.net/daigualu/article/details/70254478)| 45.8%| Easy

TodayUpdate.md

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# `Today Update`
2+
(Notes: "♥" Welcome to visit or fork or star my LeetCode Manager @
3+
https://github.com/jackzhenguo/LeetCodeManager
4+
## Sort
5+
### 324 Wiggle Sort II
6+
* [Github:#324 Wiggle Sort II](/Sort/WiggleSortSln.cs)
7+
* [CSDN:#324 Wiggle Sort II](http://blog.csdn.net/daigualu/article/details/72820281)
8+
* This is a great question for it involves a great idea: virtual index
9+
```C#
10+
/// <summary>
11+
/// WiggleSort
12+
/// </summary>
13+
public class WiggleSortSln
14+
{
15+
private static int[] _array;
16+
17+
public int[] WiggleSort(int[] array)
18+
{
19+
_array = array;
20+
int median = findKThLargest(_array.Length / 2);
21+
int left = 0, i = 0, right = _array.Length - 1;
22+
23+
while (i <= right)
24+
{
25+
if (_array[newIndex(i)] > median)
26+
{
27+
//put newIndex(i) at odd index(from 1, 3, to 5, ...)
28+
swap(newIndex(left++), newIndex(i));
29+
i++;
30+
}
31+
else if (_array[newIndex(i)] < median)
32+
{
33+
//put newIndex(i) at even index(max even index to little .... )
34+
swap(newIndex(right--), newIndex(i)); //right--, so i relatively toward right 1 step
35+
}
36+
else
37+
{
38+
i++;
39+
}
40+
}
41+
return _array;
42+
}
43+
44+
private int newIndex(int index)
45+
{
46+
return (1 + 2 * index) % (_array.Length | 1);
47+
}
48+
49+
private void swap(int i, int j)
50+
{
51+
int tmp = _array[i];
52+
_array[i] = _array[j];
53+
_array[j] = tmp;
54+
}
55+
56+
//based on quick sort to find the Kth largest in _array
57+
private int findKThLargest(int k)
58+
{
59+
int left = 0;
60+
int right = _array.Length - 1;
61+
while (true)
62+
{
63+
int pivotIndex = quickSort(left, right);
64+
if (k == pivotIndex)
65+
return _array[pivotIndex];
66+
else if (k < pivotIndex)
67+
right = pivotIndex - 1;
68+
else
69+
left = pivotIndex + 1;
70+
}
71+
}
72+
73+
private int quickSort(int lo, int hi)
74+
{
75+
int key = _array[lo];
76+
while (lo < hi)
77+
{
78+
while (lo < hi && _array[hi] >= key)
79+
hi--;
80+
//hi is less than key, hi element moves to lo index
81+
_array[lo] = _array[hi];
82+
while (lo < hi && _array[lo] < key)
83+
lo++;
84+
//lo is bigger than key, lo element moves to hi index
85+
_array[hi] = _array[lo];
86+
}
87+
_array[lo] = key;
88+
return lo;
89+
}
90+
}
91+
```
92+
## Bit Mainpulation
93+
### 342 Power of Four
94+
* [Github:#342 Power of Four](/BitManipulation/PowOfFourSln.cs)
95+
* [CSDN:#342 Power of Four](http://blog.csdn.net/daigualu/article/details/72821233)
96+
---

0 commit comments

Comments
 (0)