File tree Expand file tree Collapse file tree 6 files changed +403
-1
lines changed Expand file tree Collapse file tree 6 files changed +403
-1
lines changed Original file line number Diff line number Diff line change @@ -14,4 +14,5 @@ Date | Question | Python| Java | Tag | Difficulty | Remark
14
14
20191027|[ 509. Fibonacci Number] ( https://leetcode.com/problems/fibonacci-number/ ) |[ 509p] ( https://github.com/shishishu/leetcode-python-java/blob/master/ipynb_files/509_Fibonacci_Number.ipynb ) |[ 509j] ( https://github.com/shishishu/leetcode-python-java/blob/master/java_codes/509/Solution.java ) |DP|Easy
15
15
20191110|[ 3. Longest Substring Without Repeating Characters] ( https://leetcode.com/problems/longest-substring-without-repeating-characters/ ) |[ 003p] ( https://github.com/shishishu/leetcode-python-java/blob/master/ipynb_files/003_Longest_Substring_Without_Repeating_Characters.ipynb ) |[ 003j] ( https://github.com/shishishu/leetcode-python-java/blob/master/java_codes/003/Solution.java ) |String|Medium
16
16
20191117|[ 206. Reverse Linked List] ( https://leetcode.com/problems/reverse-linked-list/ ) |[ 206p] ( https://github.com/shishishu/leetcode-python-java/blob/master/ipynb_files/206_Reverse_Linked_List.ipynb ) |[ 206j] ( https://github.com/shishishu/leetcode-python-java/blob/master/java_codes/206/Solution.java ) |List|Easy
17
- 20191117|[ 147. Insertion Sort List] ( https://leetcode.com/problems/insertion-sort-list/ ) |[ 147p] ( https://github.com/shishishu/leetcode-python-java/blob/master/ipynb_files/147_Insertion_Sort_List.ipynb ) |[ 147j] ( https://github.com/shishishu/leetcode-python-java/blob/master/java_codes/147/Solution.java ) |Sort|Medium
17
+ 20191117|[ 147. Insertion Sort List] ( https://leetcode.com/problems/insertion-sort-list/ ) |[ 147p] ( https://github.com/shishishu/leetcode-python-java/blob/master/ipynb_files/147_Insertion_Sort_List.ipynb ) |[ 147j] ( https://github.com/shishishu/leetcode-python-java/blob/master/java_codes/147/Solution.java ) |Sort|Medium
18
+ 20191124|[ 155. Min Stack] ( https://leetcode.com/problems/min-stack/ ) |[ 155p] ( https://github.com/shishishu/leetcode-python-java/blob/master/ipynb_files/155_Min_Stack.ipynb ) |[ 155j] ( https://github.com/shishishu/leetcode-python-java/blob/master/java_codes/155/Solution.java ) |Stack|Easy
Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change
1
+ import java .util .Stack ;
2
+
3
+ class MinStack {
4
+
5
+ int min ;
6
+ Stack <Integer > stack ;
7
+
8
+ /** initialize your data structure here. */
9
+ public MinStack () {
10
+ min = Integer .MAX_VALUE ;
11
+ stack = new Stack <Integer >();
12
+ }
13
+
14
+ public void push (int x ) {
15
+ if (x <= min ){
16
+ stack .push (min );
17
+ min = x ;
18
+ }
19
+ stack .push (x );
20
+ }
21
+
22
+ public void pop () {
23
+ if (stack .pop () == min ){
24
+ min = stack .pop ();
25
+ }
26
+ }
27
+
28
+ public int top () {
29
+ return stack .peek ();
30
+ }
31
+
32
+ public int getMin () {
33
+ return min ;
34
+ }
35
+ }
36
+
37
+ /**
38
+ * Your MinStack object will be instantiated and called as such:
39
+ * MinStack obj = new MinStack();
40
+ * obj.push(x);
41
+ * obj.pop();
42
+ * int param_3 = obj.top();
43
+ * int param_4 = obj.getMin();
44
+ */
Original file line number Diff line number Diff line change 15
15
<sourceFolder url =" file://$MODULE_DIR$/003" isTestSource =" false" />
16
16
<sourceFolder url =" file://$MODULE_DIR$/206" isTestSource =" false" />
17
17
<sourceFolder url =" file://$MODULE_DIR$/147" isTestSource =" false" />
18
+ <sourceFolder url =" file://$MODULE_DIR$/155" isTestSource =" false" />
18
19
</content >
19
20
<orderEntry type =" inheritedJdk" />
20
21
<orderEntry type =" sourceFolder" forTests =" false" />
You can’t perform that action at this time.
0 commit comments