LinkedIn Interview Question

Hackerrank/Leetcode type question