测评会员优惠活动进行中 · 开通 VIP,有效期内测评不限次 VIP 优惠中 · 测评不限次 立即查看

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 }

选项(单选)