Coding Questions (2021)- MyKaarma, Cred

Akash Kumar
2 min readMar 13, 2021

--

MyKaarma

Applied through Career Page.

The first round consisted of an Online exam comprising of 2 sections, one was of MCQ’s and the other was a coding round.

Section 1: 20 MCQ on mix DS/Algo

Section 2: 3 Coding Question

  1. We have n jobs, where every job is scheduled to be done from startTime[i] to endTime[i], obtaining a profit of profit[i].You’re given the startTime, endTime and profit arrays, return the maximum profit you can take such that there are no two jobs in the subset with an overlapping time range. If you choose a job that ends at a time X you will be able to start another job that starts at the time X.
Input: startTime = [1,2,3,3], endTime = [3,4,5,6], profit = [50,10,40,70]
Output: 120

Leetcode Hard: Useful Link

2. Vipul writes numbers from N to 2 on paper. Now he takes number N and strikes of all its proper divisors. Next, he does the same with the largest number that is still not stricken(i.e strikes its proper divisors ). He does this so on until.no further number could be stricken. The task is to find the number of numbers left unstricken. (A little thought gives out the answer to be (N+1)/2)

3. Count Inversions in an array | (Using Merge Sort)

Useful Link

CRED

Applied through Referral

Only 2 questions I got in the coding round.

  1. Count of words

Given a file with text paragraphs, print the count of unique words. (the logic should be case-insensitive)

Hint: Break using space in C++( Strtok)

2. Given a list of integers, reorder them in such a way that the even numbers come at even positions (0-based indexing), and the odd numbers come at odd position, with their relative order being the same as in the original list. If the number of even numbers is greater than odd numbers (or vice-versa), the extra ones should be at the end.

Input: [42, 24, 64, 83, 12, 6, 21, 55]Output: [42, 83, 24, 21, 64, 55, 12, 6]

Hint: Store all positions of odd,even and print accordingly.

--

--

Akash Kumar
Akash Kumar

Written by Akash Kumar

MSCS @UF | Software Developer 👨‍💻, 9K Followers on LinkedIn https://www.linkedin.com/in/akash-kumar916/

Responses (1)