Skip to content

Commit

Permalink
Update ancestor.js
Browse files Browse the repository at this point in the history
  • Loading branch information
kounkou authored Nov 27, 2024
1 parent f2502a7 commit c1c56d0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions logic/linked-list/ancestor.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ var question = [
ListNode(int x) : val(x), next(nullptr) {}
};
ListNode* findAncestor(ListNode* head, int target) {
ListNode* findAncestor(ListNode* head, int v) {
ListNode* prev = nullptr;
while (head != nullptr) {
if (head->val == target) {
if (head->val == v) {
return prev;
}
prev = head;
Expand Down

0 comments on commit c1c56d0

Please sign in to comment.