Recently I gave Online Assesment at Razorpay in June 2025 and these were the questions which were asked. I have 4 years of experience as a data scientist, the role was Senior Machine Learning Engineer.
Platform: HackerEarth
Mode: Online Coding Test
Round: 1 (Online Assessment)
No. of Questions: 3
Duration: 90 Minutes
Difficulty: Medium to Hard
Implement a cache using the Least Frequently Used (LFU) eviction policy. When the cache reaches its capacity, remove the least frequently used key. If there's a tie, remove the smallest key among those with the least frequency.
def solve(N: int, Q: int, operations: List[List[int]]) -> List[int]N: Capacity of the cacheQ: Number of operationsoperations: List of operations where:
1 key → Get value from cache2 key value → Insert/Update key-value pair1 ≤ N ≤ 5 * 10^41 ≤ Q ≤ 2 * 10^51 ≤ key ≤ 2 * 10^51 ≤ value ≤ 10^92
5
1 2 -1
2 1 3
2 2 4
2 4 5
1 2 -1-1 4You're given a string S. Split it into parts such that each character appears in at most one part. The score of a part is the square of its length. Minimize the total score across all parts.
def solve(S: str) -> intx, score = x^21 ≤ len(S) ≤ 500S[i] contains lowercase letterseccbbbbdec100You're given N types of chip packets, each with:
A[i]B[i]C[i]Alice wants at least X happiness and at most Y total weight while minimizing the cost.
def solve(N: int, A: List[int], B: List[int], C: List[int], X: int, Y: int) -> intA: Happiness values (length N)B: Weights (length N)C: Costs (length N)X: Minimum required happinessY: Maximum allowed total weight1 ≤ N ≤ 1001 ≤ A[i], B[i], C[i], X, Y ≤ 1001 ≤ C[i] ≤ 10^45
1 2 3 4 5
1 2 3 4 5
5 4 3 2 1
10
105