Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit cf12f64

Browse files
Update README.md
1 parent fe62196 commit cf12f64

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

‎README.md‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2412,6 +2412,21 @@ class Solution:
24122412
def kClosest(self, points: List[List[int]], K: int) -> List[List[int]]:
24132413
return sorted(points, key=lambda x: x[0]**2 + x[1]**2)[:K]
24142414
```
2415+
## [1290. Convert Binary Number in a Linked List to Integer](https://leetcode.com/problems/convert-binary-number-in-a-linked-list-to-integer/)
2416+
```python
2417+
# Definition for singly-linked list.
2418+
# class ListNode:
2419+
# def __init__(self, x):
2420+
# self.val = x
2421+
# self.next = None
2422+
2423+
class Solution:
2424+
def getDecimalValue(self, head: ListNode) -> int:
2425+
r = 0
2426+
while head: r, head = r << 1 | head.val, head.next
2427+
return r
2428+
```
2429+
- O(N), 位运算
24152430
# 专题探索
24162431
![](思维导图.jpg)
24172432

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /