Hackerearth Problem Setter Intern Online Assessment
I am 2025 CS grad from Tier 3 , have applied to Hackerearth Problem Setter Intern position through Linkedin. I have immediately received a mail regarding online assessment. There were 3 dsa questions with a time limit of 1 hr 45 mins. The questions were 1 easy of leetcode level and two were of medium level.
-
Easy Question [20 points]
Given a string and an integer k, find the smallest character with kth largest frequency. If no such character found return -1.
Example:
s = "aabcd" , k = 2 return 'b' as b is the smallest character among b,c,d which are of 2nd largest frequency.Solved it by using sorting and using comparator.
-
Medium Question [50 points]
Given integersN , Mand a matrix containingN x Mpairsaij = {x,y}wherexandydenote the jump distance from current indexi , j. Find the minimum number of steps required to travel from0,0toN-1,M-1.
Note : If current index is[i,j], the jump can be to 8 possible cells :
[i+x,j+y],[i+x,j-y],[i-x,j+y],[i-x,j-y],
[i+y,j+x],[i+y,j-x],[i-y,j+x],[i-y,j+x].
Solved it using BFS. -
Medium Question [100 points]
Givennand two arraysa , bof size n, find number of pairsi,jwhere0<=i,j<=n-1such thatgcd(a[i],b[j]) !=1.
Thought to solve it using algo similar to eratosthenes sieve but was not able to solve.
If anyone knows any approach of 3rd question you can feel free to share it in comments.

