LinkedIn OA
Anonymous User
835

YOE: 6+
Got an Hackerrank OA for LinkedIn.
Given Time - 90 mins.

  1. Given an arbitary array of integers i.e -10^9 <= arr[i] <= 10^9.
    Find number of perfect pairs such that Perfect pair if below both conditions holds
    min(|x - y|, |x + y|) <= min(|x|, |y|)
    max(|x - y|, |x + y|) => max(|x|, |y|)

  2. https://leetcode.com/problems/longest-string-chain/description/

2nd problem was an easy DP to solve. Took 15 mins to code and submit. Approach - Top-down with memoisation. Didn't need to do a bottom up approach.

Regarding the first question, it was easy to come up with the brute force and of course you need to solve it in O(n*log(n)). So I had to sort the array and solved it in 2 pointer approach. This almost took me almost 40 mins to solve. Thankfully the 2nd one was an easy DP to solve. Never solved a problem like. It did involve some mathematics around it.

Result: Cleared. Scheduled the next set of rounds.

Comments (2)