Skip to content
Related Articles
Get the best out of our app
GFG App
Open App
geeksforgeeks
Browser
Continue

Related Articles

Paytm Interview Experience for SDE

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

For the screening test Paytm conducted a 1-hour coding round on Hackerank. There were 2 questions :

Problem 1. There are N tasks and two interns, if intern 1 completes the i_th task he gets the reward reward1[I], and if the 2nd intern completes the task he gets reaward2[i].  They can pick tasks in any order but intern 1 can only do K tasks rest of the N-K tasks has to be done by intern 2. Find the maximum collective reward they can get by completing these tasks.

Input:

N: integer
reward1: array of length N
reward2: array of length N
K: number of tasks intern1 can do

Example:

N=5
reward1=[1,2,3,1,2]
reward2=[1,1,1,5,6]
K=3

Solution: Max reward that can be collected is 17. Intern 1 does tasks 1,2 and 3 and intern 2 do 4 and 5 in order to collect max reward.

Problem 2: Given an array arr find out all the unique pairs (arr[I], arr[j]) from an array satisfying the following relation:

| arr[i]+arr[j] | + | arr[i]-arr[j] |=K
Input:
arr: an array containing N integers 
K: integer 
My Personal Notes arrow_drop_up
Last Updated : 19 Sep, 2022
Like Article
Save Article
Similar Reads