Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- multer-s3
- 알고리즘
- 배포
- AWS
- 문자열
- 컴퓨터과학
- 철학
- typescript
- computerscience
- 코드
- node배포
- Search Algorithm
- 문자열처리
- 파이썬
- lightsailor
- node.js
- 컴퓨터공학
- Local Search
- Hill Climbing
- CS
- Simulated Annealing
Archives
- Today
- Total
지식의모듈화
[LeetCode][Javascript] LinkedList Problems 본문
141. Linked List Cycle
/**
* Definition for singly-linked list.
* function ListNode(val) {
* this.val = val;
* this.next = null;
* }
*/
/**
* @param {ListNode} head
* @return {boolean}
*/
var hasCycle = function(head) {
let fast= head;
let ans=false;
while(fast&&fast.next&&head){
head=head.next
fast=fast.next.next
if(head===fast) {
ans=true;
break;
}
}
return ans
};
'PS > LeetCode' 카테고리의 다른 글
[Leetcode][JavaScript] 55. Jump Game (0) | 2022.08.17 |
---|---|
[Leetcode][Javascript] 36. Valid Sudoku (0) | 2022.08.17 |
[LeetCode][JavaScript] DFS Problems (0) | 2022.08.04 |
[LeetCode][Javascript] Binary Search Tree Problems (0) | 2022.08.04 |
[CoderPad Interview] Problem 77 [Easy] (0) | 2022.08.04 |