mirror of
https://github.com/krahets/hello-algo.git
synced 2025-11-09 09:08:56 +08:00
Fine tune the C codes.
This commit is contained in:
@ -28,12 +28,7 @@ ListNode *newListNode(int val) {
|
||||
return node;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Generate a linked list with a vector
|
||||
*
|
||||
* @param list
|
||||
* @return ListNode*
|
||||
*/
|
||||
/* Generate a linked list with a vector */
|
||||
ListNode *arrToLinkedList(const int *arr, size_t size) {
|
||||
if (size <= 0) {
|
||||
return NULL;
|
||||
@ -48,13 +43,7 @@ ListNode *arrToLinkedList(const int *arr, size_t size) {
|
||||
return dummy->next;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get a list node with specific value from a linked list
|
||||
*
|
||||
* @param head
|
||||
* @param val
|
||||
* @return ListNode*
|
||||
*/
|
||||
/* Get a list node with specific value from a linked list */
|
||||
ListNode *getListNode(ListNode *head, int val) {
|
||||
while (head != NULL && head->val != val) {
|
||||
head = head->next;
|
||||
|
||||
Reference in New Issue
Block a user