File tree 3 files changed +54
-2
lines changed
3 files changed +54
-2
lines changed Original file line number Diff line number Diff line change 71
71
| [ 068] [ 068-question ] | [ Text Justification] [ 068-tips ] | [ Hard] [ H ] | [ ✅] [ 068-java ] | | |
72
72
| [ 069] [ 069-question ] | [ Sqrt(x)] [ 069-tips ] | [ Easy] [ E ] | [ ✅] [ 069-java ] | [ ✅] [ 069-js ] | [ ✅] [ 069-kotlin ] |
73
73
| [ 070] [ 070-question ] | [ Climbing Stairs] [ 070-tips ] | [ Easy] [ E ] | [ ✅] [ 070-java ] | [ ✅] [ 070-js ] | [ ✅] [ 070-kotlin ] |
74
- | [ 083] [ 083-question ] | [ Remove Duplicates from Sorted List] [ 083-tips ] | [ Easy] [ E ] | [ ✅] [ 083-java ] | | [ ✅] [ 083-kotlin ] |
74
+ | [ 083] [ 083-question ] | [ Remove Duplicates from Sorted List] [ 083-tips ] | [ Easy] [ E ] | [ ✅] [ 083-java ] | [ ✅ ] [ 083-js ] | [ ✅] [ 083-kotlin ] |
75
75
| [ 088] [ 088-question ] | [ Merge Sorted Array] [ 088-tips ] | [ Easy] [ E ] | [ ✅] [ 088-java ] | | [ ✅] [ 088-kotlin ] |
76
76
| [ 100] [ 100-question ] | [ Same Tree] [ 100-tips ] | [ Easy] [ E ] | [ ✅] [ 100-java ] | | [ ✅] [ 100-kotlin ] |
77
77
| [ 101] [ 101-question ] | [ Symmetric Tree] [ 101-tips ] | [ Easy] [ E ] | [ ✅] [ 101-java ] | | [ ✅] [ 101-kotlin ] |
377
377
[ 067-js ] : ./src/_067/Solution.js
378
378
[ 069-js ] : ./src/_069/Solution.js
379
379
[ 070-js ] : ./src/_070/Solution.js
380
+ [ 083-js ] : ./src/_083/Solution.js
380
381
[ 226-js ] : ./src/_226/Solution.js
381
382
[ 561-js ] : ./src/_561/Solution.js
382
383
[ 643-js ] : ./src/_643/Solution.js
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Definition for singly-linked list.
3
+ * function ListNode(val) {
4
+ * this.val = val;
5
+ * this.next = null;
6
+ * }
7
+ */
8
+ /**
9
+ * @param {ListNode } head
10
+ * @return {ListNode }
11
+ */
12
+ var deleteDuplicates = function ( head ) {
13
+ if ( head === null || head . val === null || head . next === null ) {
14
+ return head
15
+ }
16
+ var current = head
17
+ var currentVal = head . val
18
+ while ( true ) {
19
+ if ( current . next === null ) {
20
+ break ;
21
+ }
22
+ if ( current . next . val === currentVal ) {
23
+ current . next = current . next . next
24
+ } else {
25
+ currentVal = current . next . val
26
+ current = current . next
27
+ }
28
+ }
29
+ return head
30
+ } ;
Original file line number Diff line number Diff line change @@ -61,7 +61,28 @@ class Solution {
61
61
}
62
62
```
63
63
64
-
64
+ javascript
65
+ ``` javascript
66
+ var deleteDuplicates = function (head ) {
67
+ if (head === null || head .val === null || head .next === null ) {
68
+ return head
69
+ }
70
+ var current = head
71
+ var currentVal = head .val
72
+ while (true ) {
73
+ if (current .next === null ) {
74
+ break ;
75
+ }
76
+ if (current .next .val === currentVal) {
77
+ current .next = current .next .next
78
+ } else {
79
+ currentVal = current .next .val
80
+ current = current .next
81
+ }
82
+ }
83
+ return head
84
+ };
85
+ ```
65
86
## 结语
66
87
67
88
如果你同我们一样热爱数据结构、算法、LeetCode,可以关注我们 GitHub 上的 LeetCode 题解:[ LeetCode-Solution] [ ls ]
You can’t perform that action at this time.
0 commit comments