contributed by < void110916
>
1
2
#include <stddef.h>
struct ListNode {
int val;
struct ListNode *next;
};
struct ListNode *deleteDuplicates(struct ListNode *head)
{
if (!head)
return NULL;
if (head->next&&head->val==head->next->val) {
/* Remove all duplicate numbers */
while (head->next&&head->val==head->next->val)
head = head->next;
return deleteDuplicates(head->next);
}
head->next = deleteDuplicates(head->next);
return head;
}
此方法有以下特點:
list 指向 NULL 的判斷有兩種意義:
因此若該 list 有
contributed by < void110916 > 實驗環境 $ gcc --version gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0 $ uname -a Linux void-pc 5.13.0-28-generic #31~20.04.1-Ubuntu SMP Wed Jan 19 14:08:10 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux $ lscpu
Feb 25, 2022在windows使用無線鍵盤時,為了支援特殊功能(ex.自定義巨集、開啟特殊程式等),鍵盤製造商通常會將按鍵映射至非不常用的鍵,再以驅動程式去觸發特定的功能。但是,通常製造商並不會特地再為Linux寫個驅動程式。因此,使用者在轉入Linux後,有可能會遇到一些按鍵功能錯亂的問題。 查詢鍵盤鍵號 在 terminal 輸入 sudo apt install evtest 安裝測試軟體 在 terminal 輸入 sudo evtest 開始程式 ( 需要 sudo 權限 ): ❯ sudo evtest No device specified, trying to scan all of /dev/input/event*
Feb 17, 2022or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up