Had a total of 70 minutes to solve 4 questions. Questions were in range of Easy Medium and Medium Hard range.
Q1. Find the sum of Maximum SubArray [https://leetcode.com/problems/maximum-subarray/]
Q2. Question was about solving a Chess Tournament
Chess Tournament
There are n participants numbered 1 to n where ith participant has the potential denoted by potential[i]. The potential of each player is distinct. Initially, all players stand in queue in order from the 1st to nth player in each game, the first 2 participant of the queue compete and the participant with a higher potential wins the game. After each game, the winner remains at the beginning of the queue and plays with the next person from the queue and the losing player goes to the end of the queue. The game continues until a player wins k consecutive games.
Given the potential of the participants and the deciding factor k, find the potential of the winning player.
Example
Consider n = 4, participants have potential [3,2,1,4] and k = 2
Return player 1s potential, 3
solve for getPotentialOfWinner(int[] potential, int k)
Q3. Visiting Cities
There are a number of cities in a row, and there are two bus lines that go between them. They both visit all cities in order, but one may take longer than the other to go between any two cities. Starting on or moving to the Blue line takes a certain amount of extra time. There is not extra time required to start on or move to the Red Line. Determine the minimum cost to move from the first city to each of the cities.
Example:
red = [2,3,4]
blue = [3,1,1]
blueCost = 2
There are 4 cities numbered 0 through 3. Times from city 0 to cities 1,2 and 3 are at indices 0,1, and 2 respectively in the red and blue arrays. Through the explanation, an answer array, ans will be created.
Solve the following:
public static List<long> minCost(List<Integer> red, List<Integer> blue, int blueCost)
Q4: Fourth question was about creating a team using the initial letters of the subjects
Given a string constisting of p, c, m, b and z. Each char represent a particular one skill of student. Given a list of student's skills find the no of teams that can be formed such that each team has 5 students and each student in team has should have different skill. A student can be only one team.
Eg - pcmpcbmz
no of teams possible - 1
[https://github.com/mkprj5/HackerRank/blob/master/Level%20Challange/ThePerfectTeam.java]