📜  Sprinklr 实习面试体验(校内)

📅  最后修改于: 2021-11-17 10:14:26             🧑  作者: Mango

1.5 小时的第一轮编码测试:

这是在 HackerRank 上进行的在线编码测试。由 3 个编码问题组成的测试。

  1. 一个医疗队想派一个最少数量的工人在城市里给人接种疫苗,每个工人可以给半径为D的区域内的人接种,并且可以从任何地方开始,给出一个数组,告诉人在X上的位置-轴,Y轴上没有人,帮助医疗队了解整个城镇接种疫苗所需的最少人数。
    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 分) – 接受 O(N) 解决方案

    (提示:对数组进行排序并一次在 2D 距离内取一组人)

  2. Sprinklr 用户在平台上看到一些重复的文档,我们需要您帮助检测这些文档并删除它们。我们已经有一个框架来检测 2 个文档是否重复,我们需要您提供给定重复文档对的情况下存在多少唯一文档。我们还想查询 2 个文档是否相似

    (75 分)

    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. 最大化总和,您将获得 N 个区间,其中第 i 个区间将从时间 Li 开始,并将在 Ri 结束并包含特殊值 Ki,您必须选择 P 个区间,以便没有区间相互重叠并最大化所选 P 区间的特殊值的总和。

    (100 分)

    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.

得分超过 125 分(也有部分评分)的学生被选中参加 Sprinklr 的面试。