File tree 7 files changed +78
-0
lines changed
S0019_remove_nth_node_from_end_of_list
S0021_merge_two_sorted_lists
S0023_merge_k_sorted_lists
S0024_swap_nodes_in_pairs
S0025_reverse_nodes_in_k_group
G0501_0600/S0543_diameter_of_binary_tree
7 files changed +78
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,16 @@ namespace LeetCodeNet.G0001_0100.S0002_add_two_numbers {
6
6
7
7
using LeetCodeNet . Com_github_leetcode ;
8
8
9
+ /**
10
+ * Definition for singly-linked list.
11
+ * public class ListNode {
12
+ * int val;
13
+ * ListNode next;
14
+ * ListNode() {}
15
+ * ListNode(int val) { this.val = val; }
16
+ * ListNode(int val, ListNode next) { this.val = val; this.next = next; }
17
+ * }
18
+ */
9
19
public class Solution {
10
20
public ListNode AddTwoNumbers ( ListNode l1 , ListNode l2 ) {
11
21
ListNode dummyHead = new ListNode ( 0 ) ;
Original file line number Diff line number Diff line change @@ -6,6 +6,17 @@ namespace LeetCodeNet.G0001_0100.S0019_remove_nth_node_from_end_of_list {
6
6
7
7
using LeetCodeNet . Com_github_leetcode ;
8
8
9
+ /**
10
+ * Definition for singly-linked list.
11
+ * public class ListNode {
12
+ * public int val;
13
+ * public ListNode next;
14
+ * public ListNode(int val=0, ListNode next=null) {
15
+ * this.val = val;
16
+ * this.next = next;
17
+ * }
18
+ * }
19
+ */
9
20
public class Solution {
10
21
private int n ;
11
22
Original file line number Diff line number Diff line change @@ -7,6 +7,17 @@ namespace LeetCodeNet.G0001_0100.S0021_merge_two_sorted_lists {
7
7
8
8
using LeetCodeNet . Com_github_leetcode ;
9
9
10
+ /**
11
+ * Definition for singly-linked list.
12
+ * public class ListNode {
13
+ * public int val;
14
+ * public ListNode next;
15
+ * public ListNode(int val=0, ListNode next=null) {
16
+ * this.val = val;
17
+ * this.next = next;
18
+ * }
19
+ * }
20
+ */
10
21
public class Solution {
11
22
public ListNode MergeTwoLists ( ListNode l1 , ListNode l2 ) {
12
23
ListNode list = new ListNode ( - 1 ) ;
Original file line number Diff line number Diff line change @@ -6,6 +6,17 @@ namespace LeetCodeNet.G0001_0100.S0023_merge_k_sorted_lists {
6
6
7
7
using LeetCodeNet . Com_github_leetcode ;
8
8
9
+ /**
10
+ * Definition for singly-linked list.
11
+ * public class ListNode {
12
+ * public int val;
13
+ * public ListNode next;
14
+ * public ListNode(int val=0, ListNode next=null) {
15
+ * this.val = val;
16
+ * this.next = next;
17
+ * }
18
+ * }
19
+ */
9
20
public class Solution {
10
21
public ListNode MergeKLists ( ListNode [ ] lists ) {
11
22
if ( lists . Length == 0 ) {
Original file line number Diff line number Diff line change @@ -6,6 +6,17 @@ namespace LeetCodeNet.G0001_0100.S0024_swap_nodes_in_pairs {
6
6
7
7
using LeetCodeNet . Com_github_leetcode ;
8
8
9
+ /**
10
+ * Definition for singly-linked list.
11
+ * public class ListNode {
12
+ * public int val;
13
+ * public ListNode next;
14
+ * public ListNode(int val=0, ListNode next=null) {
15
+ * this.val = val;
16
+ * this.next = next;
17
+ * }
18
+ * }
19
+ */
9
20
public class Solution {
10
21
public ListNode SwapPairs ( ListNode head ) {
11
22
if ( head == null ) {
Original file line number Diff line number Diff line change @@ -6,6 +6,17 @@ namespace LeetCodeNet.G0001_0100.S0025_reverse_nodes_in_k_group {
6
6
7
7
using LeetCodeNet . Com_github_leetcode ;
8
8
9
+ /**
10
+ * Definition for singly-linked list.
11
+ * public class ListNode {
12
+ * public int val;
13
+ * public ListNode next;
14
+ * public ListNode(int val=0, ListNode next=null) {
15
+ * this.val = val;
16
+ * this.next = next;
17
+ * }
18
+ * }
19
+ */
9
20
public class Solution {
10
21
public ListNode ReverseKGroup ( ListNode head , int k ) {
11
22
if ( head == null || head . next == null || k == 1 ) {
Original file line number Diff line number Diff line change @@ -6,6 +6,19 @@ namespace LeetCodeNet.G0501_0600.S0543_diameter_of_binary_tree {
6
6
7
7
using LeetCodeNet . Com_github_leetcode ;
8
8
9
+ /**
10
+ * Definition for a binary tree node.
11
+ * public class TreeNode {
12
+ * public int val;
13
+ * public TreeNode left;
14
+ * public TreeNode right;
15
+ * public TreeNode(int val=0, TreeNode left=null, TreeNode right=null) {
16
+ * this.val = val;
17
+ * this.left = left;
18
+ * this.right = right;
19
+ * }
20
+ * }
21
+ */
9
22
public class Solution {
10
23
private int diameter ;
11
24
You can’t perform that action at this time.
0 commit comments