Question DSA-TP-0066
HardWhat is the time complexity of the sliding-window algorithm for 'longest substring with at most k distinct characters'?
- A.
O(nk)
- B.
O(n)
- C.
Sign up free to see the answer and a step-by-step explanation.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Two Pointers and Sliding Window question
What is the time complexity of the sliding-window algorithm for 'longest substring with at most k distinct characters'?
O(nk)
O(n)
Sign up free to see the answer and a step-by-step explanation.
O(n²)
O(n log n)