Skip to content

Commit 8cabbca

Browse files
author
AkshayChavan
committed
fixed the test file with prettier
1 parent c957428 commit 8cabbca

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

Data-Structures/Linked-List/CycleDetectionII.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
*/
77

88
function detectCycleNode(head) {
9-
109
let length = 0
1110
let fast = head
1211
let slow = head
@@ -51,7 +50,7 @@ function lengthCycle(head) {
5150
fast = fast.next.next
5251
slow = slow.next
5352

54-
// if found a cycle, calculate the length
53+
// when fast and slow meet inside the cycle, calculate the length
5554
if (fast === slow) {
5655
let temp = slow
5756
let length = 0
@@ -69,4 +68,4 @@ function lengthCycle(head) {
6968
return 0
7069
}
7170

72-
export { detectCycleNode }
71+
export { detectCycleNode }

Data-Structures/Linked-List/test/CycleDetectionII.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ describe('Detect Cycle', () => {
88

99
expect(detectCycleNode(head)).toBeNull()
1010
})
11-
11+
1212
it('simple cycle', () => {
1313
const head = new Node(1)
1414
head.next = new Node(2)

0 commit comments

Comments
 (0)