
Time Complexity
Quiz
•
Computers
•
University
•
Practice Problem
•
Hard
Shubham Khari
Used 5+ times
FREE Resource
Enhance your content in a minute
22 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
class Solution {
public:
int maxSubArray(vector
O(n)
O(n²)
O(n log n)
O(1)
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
class Solution {
public:
vector
O(n²)
O(m × n)
O(log n)
O(n)
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
class Solution: def merge(self, intervals: List[List[int]]) -> List[List[int]]: merged = [] intervals.sort(key=lambda x: x[0]) prev = intervals[0] for interval in intervals[1:]: if interval[0] <= prev[1]: prev[1] = max(prev[1], interval[1]) else: merged.append(prev) prev = interval merged.append(prev) return merged
O(n²)
O(n)
O(n log n)
O(log n)
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
class Solution: def uniquePathsWithObstacles(self, obstacleGrid: List[List[int]]) -> int: if not obstacleGrid or obstacleGrid[0][0] == 1: return 0 rows, cols = len(obstacleGrid), len(obstacleGrid[0]) dp = [0] * cols dp[0] = 1 for r in range(rows): for c in range(cols): if obstacleGrid[r][c] == 1: dp[c] = 0 else: if c > 0: dp[c] += dp[c - 1] return dp[cols - 1]
O(n)
O(n²)
O(m × n)
O(m + n)
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
class Solution: def plusOne(self, digits: List[int]) -> List[int]: for i in range(len(digits) - 1, -1, -1): if digits[i] + 1 != 10: digits[i] += 1 return digits digits[i] = 0 if i == 0: return [1] + digits
O(n)
O(1)
O(log n)
O(n²)
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
class Solution {
public:
void setZeroes(vector
O(m × n)
O(n² log n)
O(n)
O(log n)
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
class Solution: def searchMatrix(self, matrix: List[List[int]], target: int) -> bool: top = 0 bot = len(matrix) - 1 while top <= bot: mid = (top + bot) // 2 if matrix[mid][0] < target and matrix[mid][-1] > target: break elif matrix[mid][0] > target: bot = mid - 1 else: top = mid + 1 row = (top + bot) // 2 left = 0 right = len(matrix[row]) - 1 while left <= right: mid = (left + right) // 2 if matrix[row][mid] == target: return True elif matrix[row][mid] > target: right = mid - 1 else: left = mid + 1 return False
O(n)
O(log(m × n))
O(m + n)
O(n²)
Create a free account and access millions of resources
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
20 questions
basisdata1
Quiz
•
University
20 questions
Ôn tập 2 - Tin học 3
Quiz
•
5th Grade - University
20 questions
Examen de Word Avanzado
Quiz
•
University
17 questions
Microprocessor - Intel 8088 - Part 1
Quiz
•
University
20 questions
Redes 2 - Camada de Transporte - Partes 2 de TCP até o fim
Quiz
•
University
20 questions
Kuis 2 - PKS 1
Quiz
•
University
20 questions
1ºDAM/DAW - Entornos de Desarrollo - UD1-6 - Prof. C. Boni
Quiz
•
University - Professi...
20 questions
8-期中总结
Quiz
•
University
Popular Resources on Wayground
5 questions
This is not a...winter edition (Drawing game)
Quiz
•
1st - 5th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
10 questions
Identify Iconic Christmas Movie Scenes
Interactive video
•
6th - 10th Grade
20 questions
Christmas Trivia
Quiz
•
6th - 8th Grade
18 questions
Kids Christmas Trivia
Quiz
•
KG - 5th Grade
11 questions
How well do you know your Christmas Characters?
Lesson
•
3rd Grade
14 questions
Christmas Trivia
Quiz
•
5th Grade
20 questions
How the Grinch Stole Christmas
Quiz
•
5th Grade
Discover more resources for Computers
26 questions
Christmas Movie Trivia
Lesson
•
8th Grade - Professio...
20 questions
christmas songs
Quiz
•
KG - University
20 questions
Holiday Trivia
Quiz
•
9th Grade - University
15 questions
Holiday Movies
Quiz
•
University
14 questions
Christmas Trivia
Quiz
•
3rd Grade - University
20 questions
Christmas Trivia
Quiz
•
University
8 questions
5th, Unit 4, Lesson 8
Lesson
•
KG - Professional Dev...
20 questions
Disney Trivia
Quiz
•
University
