Agoda : Software Engineer Technical Coding Interview Experience
I was referred by my friend, complete interview took 2 days with 2 weeks of interval. Each two round were continuous with 30 min break;
Round1 : DS-Algo
1.) Grilling through the Resume.
2.) kth maximum in stream of integers
Round 2 : System Design
1.) There is service A , & service B : Service A continuously & asynchronously calling service B.
eg :
service A is payment completion.
service B is email sending service.
How would you design the system , also you dont want to bombared / choke the service B.
Hint : use pool of active request and service B picks from there in a rate limitting manner.
2.) Given an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0.
Notice that the solution set must not contain duplicate triplets.
Input: nums = [-1,0,1,2,-1,-4]
Output: [[-1,-1,2],[-1,0,1]]
My inefficient solution :
#include <iostream> #include <jsoncpp/json/json.h> #include <vector> #include <set> #include <map> #include <unordered_map> using namespace std; class GetTriplets{ public : vector<vector<int>> getTriplets( vector<int> v){ unordered_map<int , set<int>> m ; vector<vector<int>> ans; for( int i = 0 ; i < v.size() ; i++ ){ m[v[i]].insert(i); } int twoSum = 0; for( int i = 0 ; i < v.size() ; i++){ m[v[i]].erase(i); for(int j = i+1 ; j < v.size()-1 ; j++){ m[v[j]].erase(i); twoSum = v[i]+v[j]; set<int> indexSet = m[-twoSum]; // m[1] => 1 if( !indexSet.empty()){ // [-1,0,1,2,-1,-4 , 2 , 1 , 1 , 1] // -1 => 0 , 4 // 0 => 1 // 1 = > 1 , 7 , 8 , 9 //2 => 3 , 6 // -1 => 4 int size = indexSet.size(); for(auto p : indexSet){ if(p > j){ vector<int> ansSet {v[i] , v[j] , -twoSum}; ans.push_back(ansSet); } } } m[v[j]].insert(i); } } return ans; } }; int main() { // std::cout << "Hello world" << std::endl; vector<int> v{-1,0,1,2,-1,-4}; GetTriplets g; vector<vector<int>> ans = g.getTriplets(v); for(vector<int> v : ans){ cout<<endl; for(int i : v){ cout<<i<<","; } } return 0; }
Round 3 : Analytical
1.) 2 eggs & 100 floor problem
Round 4:
1.) First 30 min was discussion around current employer work , role , responsibility and process.
Any new feature recently developed
2.) System Design
Given Database of 5 million row in SQL.
Table : cron
Column : userID , cronID , frequency , apiUrl , method , isActive
Problem statement : Frequency can be from 1 min to 3 days with 1 min interval. At that given frequency, system should hit the active cron apiUrl & should store the response and latency.
How will you design the system ?