添加(链表理论基础.md):增加JS和TS版本
This commit is contained in:
@@ -168,6 +168,32 @@ public class ListNode {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
JavaScript:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
class ListNode {
|
||||||
|
val;
|
||||||
|
next = null;
|
||||||
|
constructor(value) {
|
||||||
|
this.val = value;
|
||||||
|
this.next = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
TypeScript:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
class ListNode {
|
||||||
|
public val: number;
|
||||||
|
public next: ListNode = null;
|
||||||
|
constructor(value: number) {
|
||||||
|
this.val = value;
|
||||||
|
this.next = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
Python:
|
Python:
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user