Consideration make three pointers , pre,current,next; initial pre as null use tmp to save current’s next node info change current’s next to link pre node(first is null) move pre pointer to next node move current pointer to next node soultion 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 /** * Definition for singly-linked list.……
包含标签 LeetCode 的文章
hamming-distance
The Hamming distance between two integers is the number of positions at which the corresponding bits are different. Given two integers x and y, calculate the Hamming distance. Note: 0 ≤ x, y < 231. Example: Input: x = 1, y = 4 Output: 2 Explanation: 1 (0 0 0 1) 4 (0 1 0 0) ↑ ↑ The above arrows point to positions where the corresponding bits are different.……