A66886. 假设给定链表为: 1→3→5→7→nullptr ,若调⽤searchValue(head, 5) ,函数返回值为( ) 。1 int searchValue(ListNode* head, int target) {
单选题
知识点
题目描述
假设给定链表为: 1→3→5→7→nullptr ,若调⽤searchValue(head, 5) ,函数返回值为( ) 。
1 int searchValue(ListNode* head, int target) {
2 while (head != nullptr) {
3 if (head->val == target) {
4 return 1;
5 }
6 head = head->next;
7 }
8 return 0;
9 }选项(单选)
答案解析
详细答案解析为会员权益,按每日次数查看。
开通 / 升级会员