Popular Linkedin Interview Question List

user profile image
System made a post.

1, Closest K nodes to a target in BST? (Do it in O(n)?)

vector closestKValues(TreeNode* root, double target, int k) {
        vector res;
        inorder(root, target, k, res);
        return res;
    void inorder(TreeNode *root, double target, int k, vector &res) {
        if (!root) return;
        inorder(root->left, target, k, res);
        if (res.size() < k) res.push_back(root->val);
        else if (abs(root->val - target) < abs(res[0] - target)) {
        } else return;
        inorder(root->right, target, k, res);

2, Nested List sum?

3, III. Square root of a number?

int sqrt(int x) {
    if (x == 0)
        return x;
    int left = 1, right = x;
    while (true) {
        int mid = (left + right) / 2;
        if (mid > x / mid)
            right = mid - 1;
        else if (mid + 1 > x / (mid + 1))  //mid < x / mid
            return mid;
        else                                      //mid < x / mid
            left = mid + 1;

4, Expression operators? Add signs (+, -, *, /) to a string to form target

5, Top trending posts in last 5m, 1H, 1Day?

One-on-One Algorithm and Coding Training

One-on-One System Design Training

One-on-One Mock Interview

Get one-to-one training from Google Facebook engineers

Top-notch Professionals

Learn from Facebook, Google, Uber senior engineers interviewed 100+
Most recent interview questions and system design topics gathered from aonecode alumnus.
One-to-one online classes. Get feedbacks from real interviewers.

Customized Private Class

Already a coding expert? - Advance straight to hard interview topics of your interest.
New to the ground? - Develop basic coding skills with your own designated mentor.
Days before interview? - Focus on most important problems in target company question bank.

Free Consultation