First round involved 2 coding questions:
1.) Given a Linked list A of length N, we repeatedly delete consecutive sequences of nodes that sum to 0 until there are no such sequences.
After doing so, return the head of the final linked list.
NOTE:
If there are multiple consecutive sequences to delete then the sequence which occurs first will be deleted first and so on.
Problem Constraints
1 <= N <= 10^5
-10^3 <= Value in Each Link List <= 10^3
Input Format
First argument is the head pointer of the linkedlist.
Output Format
Return the head pointer of the final linkedlist as described.
Example Input
Input 1:
3 -> 4 -> -7 -> 5 -> -6 -> 6
Input 2:
1 -> 4 -> 6 -> -6 -> -4 -> 10
Input 3:
1 -> -1
Example Output
Output 1:
5
Output 2:
1 -> 10
Output 3:
2.) We have to hire a truck to deliver our packages. Given number of days to transfer packages is max D days. Higher capacity truck costs higher. Thus, find the least weight capacity of the truck to transfer all packages in max D days such that cost is minimized. We are given the weights of packages in a strict order in which it should be shipped. The truck makes single trip to ship packages in a single day, so basically you can make max D trips to ship the packages.
Input: weights = [1,2,3,4,5,6,7,8,9,10], days = 5
Output: 15
Explanation: A truck capacity of 15 is the minimum to ship all the packages in 5 days like this:
1st day: 1, 2, 3, 4, 5
2nd day: 6, 7
3rd day: 8
4th day: 9
5th day: 10
I was not able to solve any of the questions hence didn't qualify for further rounds.