mirror of
https://github.com/krahets/hello-algo.git
synced 2025-11-02 12:58:42 +08:00
Several improvements (#1002)
* Update buttons. * Update button svg * Update button * Update README.md * Update index.md * Update translation of about_the _book * Update English headings.
This commit is contained in:
@ -28,9 +28,10 @@ void removeItem(ListNode *n0) {
|
||||
|
||||
/* 访问链表中索引为 index 的节点 */
|
||||
ListNode *access(ListNode *head, int index) {
|
||||
while (head && head->next && index) {
|
||||
for (int i = 0; i < index; i++) {
|
||||
if (head == NULL)
|
||||
return NULL;
|
||||
head = head->next;
|
||||
index--;
|
||||
}
|
||||
return head;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user