DIFF.BLOG
New
Following
Discover
Jobs
More
Suggest a blog
Upvotes plugin
Report bug
Contact
About
Sign up  
2022-10-01-141-环形链表
1
·
zhuba-Ahhh
·
Oct. 1, 2022, 1:42 p.m.
Summary
141. 环形链表哈希JS12345678910111213141516171819202122232425/** * Definition for singly-linked list. * function ListNode(val) { * this.val = val; * this.next = null; * } *//** * @param {ListNode} head * @return {boolean} */var hasCycle = function(head) { if (head == null || head.next == null) { return false; } let map = new Map(); while (head != null) { if (map.has(head)) { return true; } map.set(head, true); head = head.next; } r...
Read full post on www.zhuba.cloud →
Submit
AUTHOR
RECENT POSTS FROM THE AUTHOR