File tree 1 file changed +23
-22
lines changed
1 file changed +23
-22
lines changed Original file line number Diff line number Diff line change 12
12
* @param {ListNode } head
13
13
* @return {number }
14
14
*/
15
- const llLength = ( head ) => {
16
- let count = 0 ;
17
- while ( head ) {
18
- head = head . next ;
19
- count ++ ;
20
- }
21
- return count ;
22
- } ;
23
-
24
- const reverseLL = ( head , len ) => {
25
- let count = 0 ;
26
- let temp = null ;
27
- while ( count < len ) {
28
- const next = head . next ;
29
- head . next = temp ;
30
- temp = head ;
31
- head = next ;
32
- count ++ ;
33
- }
34
- return temp ;
35
- } ;
36
-
37
15
var pairSum = function ( head ) {
38
16
const mid = llLength ( head ) / 2 ;
39
17
@@ -57,3 +35,26 @@ var pairSum = function (head) {
57
35
58
36
return max ;
59
37
} ;
38
+
39
+
40
+ var llLength = ( head ) => {
41
+ let count = 0 ;
42
+ while ( head ) {
43
+ head = head . next ;
44
+ count ++ ;
45
+ }
46
+ return count ;
47
+ } ;
48
+
49
+ var reverseLL = ( head , len ) => {
50
+ let count = 0 ;
51
+ let temp = null ;
52
+ while ( count < len ) {
53
+ const next = head . next ;
54
+ head . next = temp ;
55
+ temp = head ;
56
+ head = next ;
57
+ count ++ ;
58
+ }
59
+ return temp ;
60
+ } ;
You can’t perform that action at this time.
0 commit comments