Episode 7 — DSA with JavaScript / 7.6 — Time and Space Complexity

7.6.a — Big-O Notation & Complexity Classes

<< 7.6 Overview


What is time complexity?

Time complexity measures how the running time of an algorithm grows as the input size n increases. We care about the growth rate, not exact time.


Big-O notation

Big-O describes the upper bound — the worst-case growth rate.

Big-O Comparison (growth rate as n increases):
                                         ╱ O(n!)
                                       ╱
Time                                 ╱   O(2ⁿ)
  ▲                                ╱
  │                              ╱
  │                           ╱    O(n²)
  │                        ╱╱
  │                    ╱╱╱
  │               ╱╱╱         O(n log n)
  │          ╱╱╱╱
  │     ╱╱╱╱                  O(n)
  │ ╱╱╱╱
  │╱╱╱╱╱───────────────────── O(log n)
  │━━━━━━━━━━━━━━━━━━━━━━━━━━ O(1)
  └──────────────────────────▶ n (input size)

O(1) — Constant time

The algorithm takes the same time regardless of input size.

// Array access by index — O(1)
function getFirst(arr) {
    return arr[0];
}

// Hash map lookup — O(1) average
function lookup(map, key) {
    return map[key];
}

// Math operation — O(1)
function isEven(n) {
    return n % 2 === 0;
}
int getFirst(const vector<int>& arr) {
    return arr[0];   // O(1)
}

bool isEven(int n) {
    return n % 2 == 0;   // O(1)
}

O(log n) — Logarithmic time

Each step halves the remaining work. Classic example: binary search.

Binary search on [1, 3, 5, 7, 9, 11, 13, 15]
Target: 11

Step 1: mid = 7,  11 > 7  → search right half [9, 11, 13, 15]
Step 2: mid = 11, 11 == 11 → found!

n=8 elements → only 3 steps (log₂8 = 3)
n=1000000 → only 20 steps!
function binarySearch(arr, target) {
    let lo = 0, hi = arr.length - 1;
    while (lo <= hi) {
        const mid = Math.floor((lo + hi) / 2);
        if (arr[mid] === target) return mid;
        if (arr[mid] < target) lo = mid + 1;
        else hi = mid - 1;
    }
    return -1;
}
int binarySearch(const vector<int>& arr, int target) {
    int lo = 0, hi = arr.size() - 1;
    while (lo <= hi) {
        int mid = lo + (hi - lo) / 2;
        if (arr[mid] == target) return mid;
        if (arr[mid] < target) lo = mid + 1;
        else hi = mid - 1;
    }
    return -1;
}

Other O(log n) examples: balanced BST operations, exponentiation by squaring.


O(n) — Linear time

Process each element once.

function sum(arr) {
    let total = 0;
    for (let i = 0; i < arr.length; i++) {
        total += arr[i];   // n iterations
    }
    return total;
}

function findMax(arr) {
    let max = arr[0];
    for (const x of arr) {
        if (x > max) max = x;
    }
    return max;
}
int sum(const vector<int>& arr) {
    int total = 0;
    for (int x : arr) total += x;
    return total;
}

O(n log n) — Linearithmic time

Divide and conquer with linear work at each level. Classic: merge sort.

Merge sort recursion tree (n=8):

Level 0:  [8 elements]             ← n work
Level 1:  [4] [4]                  ← n work
Level 2:  [2][2] [2][2]            ← n work
Level 3:  [1][1][1][1][1][1][1][1] ← n work

log₂(8) = 3 levels × n work each = O(n log n)
function mergeSort(arr) {
    if (arr.length <= 1) return arr;
    const mid = Math.floor(arr.length / 2);
    const left = mergeSort(arr.slice(0, mid));
    const right = mergeSort(arr.slice(mid));
    return merge(left, right);
}

function merge(a, b) {
    const result = [];
    let i = 0, j = 0;
    while (i < a.length && j < b.length) {
        result.push(a[i] <= b[j] ? a[i++] : b[j++]);
    }
    return result.concat(a.slice(i)).concat(b.slice(j));
}

O(n²) — Quadratic time

Nested loops where both iterate over n.

// Bubble sort — O(n²)
function bubbleSort(arr) {
    for (let i = 0; i < arr.length; i++) {
        for (let j = 0; j < arr.length - i - 1; j++) {
            if (arr[j] > arr[j+1]) {
                [arr[j], arr[j+1]] = [arr[j+1], arr[j]];
            }
        }
    }
    return arr;
}

// Check all pairs — O(n²)
function hasDuplicate(arr) {
    for (let i = 0; i < arr.length; i++) {
        for (let j = i + 1; j < arr.length; j++) {
            if (arr[i] === arr[j]) return true;
        }
    }
    return false;
}
void bubbleSort(vector<int>& arr) {
    int n = arr.size();
    for (int i = 0; i < n; i++)
        for (int j = 0; j < n - i - 1; j++)
            if (arr[j] > arr[j+1]) swap(arr[j], arr[j+1]);
}

O(2ⁿ) — Exponential time

Each element doubles the work. Classic: naive Fibonacci.

fib(5) call tree:
                fib(5)
              /        \
          fib(4)       fib(3)
         /     \       /    \
      fib(3)  fib(2) fib(2) fib(1)
      /    \
   fib(2) fib(1)
function fib(n) {
    if (n <= 1) return n;
    return fib(n - 1) + fib(n - 2);  // two recursive calls
}
// fib(40) takes seconds; fib(50) takes minutes!

Optimization: memoization → O(n) time, O(n) space.

function fibMemo(n, memo = {}) {
    if (n <= 1) return n;
    if (memo[n]) return memo[n];
    memo[n] = fibMemo(n - 1, memo) + fibMemo(n - 2, memo);
    return memo[n];
}

O(n!) — Factorial time

Generating all permutations.

function permutations(arr) {
    if (arr.length <= 1) return [arr];
    const result = [];
    for (let i = 0; i < arr.length; i++) {
        const rest = arr.slice(0, i).concat(arr.slice(i + 1));
        for (const perm of permutations(rest)) {
            result.push([arr[i], ...perm]);
        }
    }
    return result;
}
// n=10 → 3,628,800 permutations

Space complexity

Space complexity measures the extra memory used by an algorithm.

PatternSpace
Fixed variablesO(1)
Array of size nO(n)
2D matrix n×nO(n²)
Recursive call stack depth dO(d)
Hash map with n entriesO(n)
// O(1) space — in-place
function reverse(arr) {
    let l = 0, r = arr.length - 1;
    while (l < r) { [arr[l], arr[r]] = [arr[r], arr[l]]; l++; r--; }
}

// O(n) space — new array
function reversed(arr) {
    return [...arr].reverse();
}

Complexity comparison table

Big-ONamen=10n=100n=1000Example
O(1)Constant111Array access
O(log n)Logarithmic3710Binary search
O(n)Linear101001000Linear search
O(n log n)Linearithmic336649966Merge sort
O(n²)Quadratic10010K1MBubble sort
O(2ⁿ)Exponential102410³⁰10³⁰¹Subsets
O(n!)Factorial3.6M10¹⁵⁷Permutations

Rules for calculating Big-O

  1. Drop constants: O(2n) → O(n)
  2. Drop lower-order terms: O(n² + n) → O(n²)
  3. Different inputs, different variables: O(n + m), not O(n)
  4. Sequential operations add: O(n) + O(m) = O(n + m)
  5. Nested operations multiply: O(n) × O(m) = O(n × m)
function example(arr) {
    // Phase 1: O(n)
    for (let i = 0; i < arr.length; i++) { /* ... */ }

    // Phase 2: O(n)
    for (let i = 0; i < arr.length; i++) { /* ... */ }

    // Total: O(n) + O(n) = O(2n) = O(n)
}

function nested(arr) {
    for (let i = 0; i < arr.length; i++) {       // O(n)
        for (let j = 0; j < arr.length; j++) {   //  × O(n)
            // O(1) work
        }
    }
    // Total: O(n²)
}

Amortized complexity

Some operations are O(1) amortized — usually O(1) but occasionally O(n).

Example: Array.push() in JS / vector::push_back() in C++.

  • Most pushes are O(1)
  • When capacity is exceeded, the array is resized (O(n))
  • But resizing happens rarely, so averaged over n pushes → O(1) each

Scenario bank (Big-O)

7.6a-001 — Identify complexity of a single loop (variation 1)

  • Level: Beginner
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-002 — Identify complexity of nested loops (variation 2)

  • Level: Beginner
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-003 — Analyze binary search complexity (variation 3)

  • Level: Beginner
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-004 — Compare two algorithms for the same problem (variation 4)

  • Level: Beginner
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-005 — Identify best/worst/average case for quicksort (variation 5)

  • Level: Beginner
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-006 — Calculate complexity with logarithmic inner loop (variation 6)

  • Level: Beginner
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-007 — Analyze recursive Fibonacci complexity (variation 7)

  • Level: Beginner
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-008 — Identify amortized complexity of dynamic array (variation 8)

  • Level: Beginner
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-009 — Analyze space complexity of recursive function (variation 9)

  • Level: Beginner
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-010 — Compare sorting algorithms by complexity (variation 10)

  • Level: Beginner
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-011 — Identify complexity of hash map operations (variation 11)

  • Level: Beginner
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-012 — Analyze complexity of BFS/DFS on a graph (variation 12)

  • Level: Beginner
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-013 — Calculate complexity of matrix multiplication (variation 13)

  • Level: Beginner
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-014 — Identify complexity of string concatenation in a loop (variation 14)

  • Level: Beginner
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-015 — Analyze complexity of two-pointer technique (variation 15)

  • Level: Beginner
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-016 — Compare iterative vs recursive approach complexity (variation 16)

  • Level: Beginner
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-017 — Identify complexity of sliding window (variation 17)

  • Level: Beginner
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-018 — Analyze complexity of prefix sum build + query (variation 18)

  • Level: Beginner
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-019 — Identify complexity of sieve of Eratosthenes (variation 19)

  • Level: Beginner
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-020 — Calculate complexity of merge sort with proof (variation 20)

  • Level: Beginner
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-021 — Identify complexity of a single loop (variation 21)

  • Level: Beginner
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-022 — Identify complexity of nested loops (variation 22)

  • Level: Beginner
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-023 — Analyze binary search complexity (variation 23)

  • Level: Beginner
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-024 — Compare two algorithms for the same problem (variation 24)

  • Level: Beginner
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-025 — Identify best/worst/average case for quicksort (variation 25)

  • Level: Beginner
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-026 — Calculate complexity with logarithmic inner loop (variation 26)

  • Level: Beginner
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-027 — Analyze recursive Fibonacci complexity (variation 27)

  • Level: Beginner
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-028 — Identify amortized complexity of dynamic array (variation 28)

  • Level: Beginner
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-029 — Analyze space complexity of recursive function (variation 29)

  • Level: Beginner
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-030 — Compare sorting algorithms by complexity (variation 30)

  • Level: Beginner
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-031 — Identify complexity of hash map operations (variation 31)

  • Level: Beginner
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-032 — Analyze complexity of BFS/DFS on a graph (variation 32)

  • Level: Beginner
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-033 — Calculate complexity of matrix multiplication (variation 33)

  • Level: Beginner
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-034 — Identify complexity of string concatenation in a loop (variation 34)

  • Level: Beginner
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-035 — Analyze complexity of two-pointer technique (variation 35)

  • Level: Beginner
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-036 — Compare iterative vs recursive approach complexity (variation 36)

  • Level: Beginner
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-037 — Identify complexity of sliding window (variation 37)

  • Level: Beginner
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-038 — Analyze complexity of prefix sum build + query (variation 38)

  • Level: Beginner
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-039 — Identify complexity of sieve of Eratosthenes (variation 39)

  • Level: Beginner
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-040 — Calculate complexity of merge sort with proof (variation 40)

  • Level: Beginner
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-041 — Identify complexity of a single loop (variation 41)

  • Level: Beginner
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-042 — Identify complexity of nested loops (variation 42)

  • Level: Beginner
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-043 — Analyze binary search complexity (variation 43)

  • Level: Beginner
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-044 — Compare two algorithms for the same problem (variation 44)

  • Level: Beginner
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-045 — Identify best/worst/average case for quicksort (variation 45)

  • Level: Beginner
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-046 — Calculate complexity with logarithmic inner loop (variation 46)

  • Level: Beginner
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-047 — Analyze recursive Fibonacci complexity (variation 47)

  • Level: Beginner
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-048 — Identify amortized complexity of dynamic array (variation 48)

  • Level: Beginner
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-049 — Analyze space complexity of recursive function (variation 49)

  • Level: Beginner
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-050 — Compare sorting algorithms by complexity (variation 50)

  • Level: Beginner
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-051 — Identify complexity of hash map operations (variation 51)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-052 — Analyze complexity of BFS/DFS on a graph (variation 52)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-053 — Calculate complexity of matrix multiplication (variation 53)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-054 — Identify complexity of string concatenation in a loop (variation 54)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-055 — Analyze complexity of two-pointer technique (variation 55)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-056 — Compare iterative vs recursive approach complexity (variation 56)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-057 — Identify complexity of sliding window (variation 57)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-058 — Analyze complexity of prefix sum build + query (variation 58)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-059 — Identify complexity of sieve of Eratosthenes (variation 59)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-060 — Calculate complexity of merge sort with proof (variation 60)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-061 — Identify complexity of a single loop (variation 61)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-062 — Identify complexity of nested loops (variation 62)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-063 — Analyze binary search complexity (variation 63)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-064 — Compare two algorithms for the same problem (variation 64)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-065 — Identify best/worst/average case for quicksort (variation 65)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-066 — Calculate complexity with logarithmic inner loop (variation 66)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-067 — Analyze recursive Fibonacci complexity (variation 67)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-068 — Identify amortized complexity of dynamic array (variation 68)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-069 — Analyze space complexity of recursive function (variation 69)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-070 — Compare sorting algorithms by complexity (variation 70)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-071 — Identify complexity of hash map operations (variation 71)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-072 — Analyze complexity of BFS/DFS on a graph (variation 72)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-073 — Calculate complexity of matrix multiplication (variation 73)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-074 — Identify complexity of string concatenation in a loop (variation 74)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-075 — Analyze complexity of two-pointer technique (variation 75)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-076 — Compare iterative vs recursive approach complexity (variation 76)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-077 — Identify complexity of sliding window (variation 77)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-078 — Analyze complexity of prefix sum build + query (variation 78)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-079 — Identify complexity of sieve of Eratosthenes (variation 79)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-080 — Calculate complexity of merge sort with proof (variation 80)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-081 — Identify complexity of a single loop (variation 81)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-082 — Identify complexity of nested loops (variation 82)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-083 — Analyze binary search complexity (variation 83)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-084 — Compare two algorithms for the same problem (variation 84)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-085 — Identify best/worst/average case for quicksort (variation 85)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-086 — Calculate complexity with logarithmic inner loop (variation 86)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-087 — Analyze recursive Fibonacci complexity (variation 87)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-088 — Identify amortized complexity of dynamic array (variation 88)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-089 — Analyze space complexity of recursive function (variation 89)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-090 — Compare sorting algorithms by complexity (variation 90)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-091 — Identify complexity of hash map operations (variation 91)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-092 — Analyze complexity of BFS/DFS on a graph (variation 92)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-093 — Calculate complexity of matrix multiplication (variation 93)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-094 — Identify complexity of string concatenation in a loop (variation 94)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-095 — Analyze complexity of two-pointer technique (variation 95)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-096 — Compare iterative vs recursive approach complexity (variation 96)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-097 — Identify complexity of sliding window (variation 97)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-098 — Analyze complexity of prefix sum build + query (variation 98)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-099 — Identify complexity of sieve of Eratosthenes (variation 99)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-100 — Calculate complexity of merge sort with proof (variation 100)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-101 — Identify complexity of a single loop (variation 101)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-102 — Identify complexity of nested loops (variation 102)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-103 — Analyze binary search complexity (variation 103)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-104 — Compare two algorithms for the same problem (variation 104)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-105 — Identify best/worst/average case for quicksort (variation 105)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-106 — Calculate complexity with logarithmic inner loop (variation 106)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-107 — Analyze recursive Fibonacci complexity (variation 107)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-108 — Identify amortized complexity of dynamic array (variation 108)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-109 — Analyze space complexity of recursive function (variation 109)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-110 — Compare sorting algorithms by complexity (variation 110)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-111 — Identify complexity of hash map operations (variation 111)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-112 — Analyze complexity of BFS/DFS on a graph (variation 112)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-113 — Calculate complexity of matrix multiplication (variation 113)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-114 — Identify complexity of string concatenation in a loop (variation 114)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-115 — Analyze complexity of two-pointer technique (variation 115)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-116 — Compare iterative vs recursive approach complexity (variation 116)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-117 — Identify complexity of sliding window (variation 117)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-118 — Analyze complexity of prefix sum build + query (variation 118)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-119 — Identify complexity of sieve of Eratosthenes (variation 119)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-120 — Calculate complexity of merge sort with proof (variation 120)

  • Level: Intermediate
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-121 — Identify complexity of a single loop (variation 121)

  • Level: Advanced
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-122 — Identify complexity of nested loops (variation 122)

  • Level: Advanced
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-123 — Analyze binary search complexity (variation 123)

  • Level: Advanced
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-124 — Compare two algorithms for the same problem (variation 124)

  • Level: Advanced
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-125 — Identify best/worst/average case for quicksort (variation 125)

  • Level: Advanced
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-126 — Calculate complexity with logarithmic inner loop (variation 126)

  • Level: Advanced
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-127 — Analyze recursive Fibonacci complexity (variation 127)

  • Level: Advanced
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-128 — Identify amortized complexity of dynamic array (variation 128)

  • Level: Advanced
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-129 — Analyze space complexity of recursive function (variation 129)

  • Level: Advanced
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-130 — Compare sorting algorithms by complexity (variation 130)

  • Level: Advanced
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-131 — Identify complexity of hash map operations (variation 131)

  • Level: Advanced
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-132 — Analyze complexity of BFS/DFS on a graph (variation 132)

  • Level: Advanced
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-133 — Calculate complexity of matrix multiplication (variation 133)

  • Level: Advanced
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-134 — Identify complexity of string concatenation in a loop (variation 134)

  • Level: Advanced
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-135 — Analyze complexity of two-pointer technique (variation 135)

  • Level: Advanced
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-136 — Compare iterative vs recursive approach complexity (variation 136)

  • Level: Advanced
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-137 — Identify complexity of sliding window (variation 137)

  • Level: Advanced
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-138 — Analyze complexity of prefix sum build + query (variation 138)

  • Level: Advanced
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-139 — Identify complexity of sieve of Eratosthenes (variation 139)

  • Level: Advanced
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-140 — Calculate complexity of merge sort with proof (variation 140)

  • Level: Advanced
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-141 — Identify complexity of a single loop (variation 141)

  • Level: Advanced
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-142 — Identify complexity of nested loops (variation 142)

  • Level: Advanced
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-143 — Analyze binary search complexity (variation 143)

  • Level: Advanced
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-144 — Compare two algorithms for the same problem (variation 144)

  • Level: Advanced
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-145 — Identify best/worst/average case for quicksort (variation 145)

  • Level: Advanced
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-146 — Calculate complexity with logarithmic inner loop (variation 146)

  • Level: Advanced
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-147 — Analyze recursive Fibonacci complexity (variation 147)

  • Level: Advanced
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-148 — Identify amortized complexity of dynamic array (variation 148)

  • Level: Advanced
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-149 — Analyze space complexity of recursive function (variation 149)

  • Level: Advanced
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-150 — Compare sorting algorithms by complexity (variation 150)

  • Level: Advanced
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-151 — Identify complexity of hash map operations (variation 151)

  • Level: Advanced
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-152 — Analyze complexity of BFS/DFS on a graph (variation 152)

  • Level: Advanced
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-153 — Calculate complexity of matrix multiplication (variation 153)

  • Level: Advanced
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-154 — Identify complexity of string concatenation in a loop (variation 154)

  • Level: Advanced
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-155 — Analyze complexity of two-pointer technique (variation 155)

  • Level: Advanced
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-156 — Compare iterative vs recursive approach complexity (variation 156)

  • Level: Advanced
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-157 — Identify complexity of sliding window (variation 157)

  • Level: Advanced
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-158 — Analyze complexity of prefix sum build + query (variation 158)

  • Level: Advanced
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-159 — Identify complexity of sieve of Eratosthenes (variation 159)

  • Level: Advanced
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-160 — Calculate complexity of merge sort with proof (variation 160)

  • Level: Advanced
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-161 — Identify complexity of a single loop (variation 161)

  • Level: Advanced
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-162 — Identify complexity of nested loops (variation 162)

  • Level: Advanced
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-163 — Analyze binary search complexity (variation 163)

  • Level: Advanced
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-164 — Compare two algorithms for the same problem (variation 164)

  • Level: Advanced
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-165 — Identify best/worst/average case for quicksort (variation 165)

  • Level: Advanced
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-166 — Calculate complexity with logarithmic inner loop (variation 166)

  • Level: Advanced
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-167 — Analyze recursive Fibonacci complexity (variation 167)

  • Level: Advanced
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-168 — Identify amortized complexity of dynamic array (variation 168)

  • Level: Advanced
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-169 — Analyze space complexity of recursive function (variation 169)

  • Level: Advanced
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.

7.6a-170 — Compare sorting algorithms by complexity (variation 170)

  • Level: Advanced
  • Approach: Apply appropriate technique for this problem class.
  • Time complexity: Analyze based on input size.
  • Space complexity: Identify auxiliary space used.
  • Edge cases: empty input, single element, boundary values.
  • JS & C++: Implement in both languages.