CS Fundamentals Trainer · Algorithms & Data Structures · JavaScript
What is the time complexity of this code?
function first(arr) {
return arr[0];
}
- O(1)
- O(log n)
- O(n)
- O(n log n)
Difficulty: easy
CS Fundamentals Trainer · Algorithms & Data Structures · JavaScript
function first(arr) {
return arr[0];
}
Difficulty: easy