MCPcopy Create free account
hub / github.com/neetcode-gh/leetcode / isStreak

Function isStreak

javascript/0128-longest-consecutive-sequence.js:26–34  ·  view source on GitHub ↗
(nums, num)

Source from the content-addressed store, hash-verified

24};
25
26const isStreak = (nums, num) => {
27 for (let i = 0; i < nums.length; i++) {
28 /* Time O(N) */
29 const isEqual = nums[i] === num;
30 if (isEqual) return true;
31 }
32
33 return false;
34};
35
36/**
37 * Sort - HeapSort Space O(1) | QuickSort Space O(log(K))

Callers 1

longestConsecutiveFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected