Open In App

Sprinklr Internship Interview Experience (On-Campus)

Last Updated : 03 Aug, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

Round One Coding test of 1.5 Hours:

It was an online coding test conducted on HackerRank. A test consisting of 3 coding questions.

  1. A medical team wants to send a minimum number of workers for vaccinating people in the city, each worker can vaccinate people in an area whose radius is D, and can start from anywhere, an array is given which tells the location of people on the X-axis, there is no one on Y-Axis, help the medical team to know the minimum number of people needed to vaccinate the whole town.
    Example : D - 2 , arr = {1,2,4,7,8,9,10,12,14,16,18,20}
    Output : 4
    Explaination :- (1,2,4) , (7,8,9,10) , 
    (12,14,16) , (18,20) , workers will 
    be divided like this

    (50 Marks) – O(N) solution accepted

    (HINT: sort the array and take the group of people in a 2D distance at once)

  2. Sprinklr users are seeing some duplicate documents on the platform and we need you to help to detect those documents and remove them. We already have a framework to detect if 2 documents are duplicates or not, what we need from you is how many unique documents are present given pairs of duplicate documents. We also want to query if 2 documents are similar or not

    (75 Marks)

    Input Format :-
    N : total documents
    OPS - total operations
    
    next ops line will contain 3 space 
    separate integers say(op , doc1 , doc2)
    where the first integer (op) denotes 
    operation type and remaining two 
    are documents numbers
    
    op = 0 , means next 2 documents are similar
    OUTPUT :-
    Single integer in new line 
    for every query , 0 if 
    documents are not duplicate ,
    1 if documents are duplicateSingle 
    integer in new line for every query ,
    0 if documents are not duplicate , 
    1 if documents are duplicate
    EXAMPLE :-
    10      
    5      
    0 1 2      
    0 5 7
    1 1 3
    0 2 3
    1 1 3
    OUTPUT :-
    0
    1
    7
    EXPLAINATION :-
    There are total of 10 documents
    Given 5 operations are :-
    1) Mark the document 1 & 2 duplicate
    2) Mark the document 5 & 7 duplicate
    3) Query if document 1 & 3 are duplicate , 
    hence the first line in output 0
    4) Mark the document 2 & 3 duplicate
    5) Query if document 1 & 3 are duplicate , 
    hence the second line in output 1
    Print total unique documents now
    (1,2,3) , (5,7) , (4) , (6) , (8) ,
    (9) , (10) = total 7 unique documents
    Hint :-
    two ways through which this 
    problem can be solved
    1) using dfs traversal in each query , 
    similar to count total number 
    of connected components
    2) using disjoint set union method
  3. Maximise the sum, you will be given N intervals, where i’th interval will start at time Li and will be finished at Ri and contains the special value Ki, You have to select P intervals such that no intervals overlap each other and maximize the sum of special values of the selected P intervals.

    (100 Marks)

    Constraints
    1<= N <= 10^5
    1<= P <= 10^2
    1<= N*P <= 10^6
    1<= Li , Ri <= 10^9
    1<=Ki <= 10^6
    
    Example :-
    consider N=3 and P=2 and 
    the intervals are
    1 3 10
    2 5 15
    5 7 6
    Here the answer is 16 , 
    as taking 1st and 3rd intervals 
    will be optimal
    Input Format :-
    first line contains N and P
    N lines follow 3 space separated 
    integers Li , Ri , Ki
    Sample Input
    3 2
    1 3 10
    2 5 15
    5 7 6
    
    Sample Output
    16
    
    HINT :-
    Try to think DP with Binary Search
     in every recursive stack.

Students who scored more than 125 marks (partial marking is also there) were selected for interview in Sprinklr.


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads