题解 | #判断链表中是否有环#
判断链表中是否有环
http://www.nowcoder.com/practice/650474f313294468a4ded3ce0f7898b9
bool hasCycle(struct ListNode* head ) { // write code here if(head==NULL){ return false; } int i = 0; while(i<=10000&&head->next!=NULL){ head=head->next; i++; } return i<10000?false:true; }
直接暴力解题,但这种写法毫无营养,害,搞笑的
顺丰集团工作强度 322人发布