LiveRamp

2 DSA problems asked in LiveRamp coding interviews

2 Easy
0 Medium
0 Hard
​

2 problems

Arrays & Hashing
1
Distribute Candies
Easy

Alice has n candies, where the ith candy is of type candyType[i]. A doctor told her to eat only n / 2 of them (n is always even). She wants to eat as many different types of candy as possible. Given candyType, return the maximum number of different types she can eat if she eats only n / 2 of them.

Sliding Window
1
Longest Harmonious Subsequence
Easy

We define a harmonious array as an array where the difference between its maximum value and its minimum value is exactly `1`. Given an integer array `nums`, return the length of its longest harmonious subsequence among all its possible subsequences. A subsequence is derived from the array by deleting some or no elements without changing the order of the remaining elements.