Commvault

Details

Job Status

Full Time (Employment + Internship Mandatory)

Criteria

StudyCutoff
X75%
XII75%
UG80%

Round 1 - Coding Round

01/08/23

Two job roles were offered, QA and SDE, QA only had python as an option and SDE had an option between JAVA and CPP, I chose CPP.

There were 2 sections timed separately.

  1. CPP Fundamentals and Generics MCQ (13)
  2. Coding (3)

Coding Questions

  1. Reverse alternate K nodes in a Singly Linked List

A function to reverse a linked list given head and apply this every other m nodes.


  1. Given a BST, and two values p and q, find the largest value in the path from p to q. Both p and q exist.

Find the lowest common ancestor and traverse right.

int solve(Node *head, int p, int q) {
    Node *p1 = head;
    while (true) {
        if (p1->data > p && p1->data > q) {
            p1 = p1->left;
        }
        else if (p1->data < p && p1->data < q) {
            p1 = p1->right;
        }
        else {
            break;
        }
    }

    int maxVal = max(p, q);
    int result = 0;
    while (p1 != maxVal) {
        if (p1->data > maxVal) {
            p1 = p1->left;
        }
        else if (p1->data < maxVal) {
            p1 = p1->right;
        }
        result = max(result, p1->data);
    }
    return result;
}

  1. A mountain of q meters high exists, with q-1 supports spaced out every 1 meter. Can jump at most r supports at once. Starting from the bottom find the total number of ways to reach the peak.

Have a DP array and keep updating its values from right to left. Similar to Climbing Stairs

int solve(int q, int r) {
    vector<int> dp(q);
    for (int i = q - 1; i >= 0; --i) {
        int count = 0;
        for (int j = 1; j < r; ++j) {
            if (i + j == q) {
                ++count;
            }
            else if (i + j < q) {
                count += dp[i + j];
            }
            else {
                break;
            }
        }
        dp[i] = count;
    }
    return dp[0];
}

Round 2 - Design Round

  • Build a tool to represent two snaps of a filesystem in memory.

    More detailed document was provided and had to meet certain milestones every few hours.
    The solution should be highly scalable, and have decent performance.

    Some pre-defined functions with class implementations were provided and we had to complete the function definitions.