Merge pull request #2066 from skyclouds2001/patch-1

链表相交文档结构格式化
This commit is contained in:
程序员Carl
2023-05-08 12:54:25 +08:00
committed by GitHub

View File

@ -101,8 +101,8 @@ public:
## 其他语言版本
Java
### Java
```Java
public class Solution {
public ListNode getIntersectionNode(ListNode headA, ListNode headB) {
@ -150,9 +150,13 @@ public class Solution {
}
```
### Python
Python
```python
版本一求长度同时出发
class Solution:
def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> ListNode:
lenA, lenB = 0, 0
@ -255,6 +259,7 @@ class Solution:
# self.val = x
# self.next = None
class Solution:
def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> ListNode:
# 处理边缘情况
@ -274,7 +279,8 @@ class Solution:
# 如果相交指针将位于交点节点如果没有交点值为None
return pointerA
```
### Go
Go:
```go
func getIntersectionNode(headA, headB *ListNode) *ListNode {
@ -335,7 +341,7 @@ func getIntersectionNode(headA, headB *ListNode) *ListNode {
}
```
### javaScript
JavaScript
```js
var getListLen = function(head) {
@ -447,6 +453,7 @@ ListNode *getIntersectionNode(ListNode *headA, ListNode *headB) {
```
Scala:
```scala
object Solution {
def getIntersectionNode(headA: ListNode, headB: ListNode): ListNode = {