Status: 1.9 YOE, IT from IIIT
Position: SDE-1
Location: Bangalore, India
Date: April 2023
Round 1 | HR phone screen (30 Mins):
- Introduction about G-P
- What is G-P and what problem it solves?Round 2 | HR phone screen (1 hour):
- Company cultureRound 3 | Coding (1 hour):
Question:
Given an array of elements, where all the elements appear two time except one element.
Find the element that appears only one time.
Case 1: Elements in array can appear in any order.
Solution: Unordered HashMap to maintain frequency count.
Case 2: Same elements are always together.
Solution: Binary search.
#include <bits/stdc++.h>
using namespace std;
int fun(vector<int> arr) {
int n = arr.size();
int low = 0, high = n-1;
while(high-low>2) {
int mid = low + (high-low)/2;
if(arr[mid]!=arr[mid-1] && arr[mid]!=arr[mid+1])
return arr[mid];
if((mid-low+1)%2==0) {
if(arr[mid]==arr[mid-1]) {
low = mid+1;
}
else {
high = mid-1;
}
}
else {
if(arr[mid]==arr[mid+1]) {
low = mid+1;
}
else {
high = mid-1;
}
}
}
if(low+2>=n) low--;
return (arr[low]==arr[low+1]) ? arr[low+2] : arr[low];
}
int main() {
vector<int> arr = {2,2,3,3,4,4,5};
cout<<fun(arr)<<endl;
arr = {2,2,4,4,5};
cout<<fun(arr)<<endl;
arr = {2,2,3,3,4,4,5,7,7,8,8};
cout<<fun(arr)<<endl;
arr = {1,2,2,3,3,4,4,5,5};
cout<<fun(arr)<<endl;
arr = {0,0,1,2,2,3,3,4,4,5,5};
cout<<fun(arr)<<endl;
arr = {2,2,6,3,3,4,4,5,5};
cout<<fun(arr)<<endl;
}
Note: Solution can be simplified but this worked for me.Round 4 | Managerial round (1 hour):
- About your life journey and why G-P you choose to work at G-P?
- Would you choose G-P over other offers and why?Verdict: SELECTED
Offer: DECLINED
Compensation: https://leetcode.com/discuss/compensation/3484266/globalization-partners-software-engineer-ii-remote/1889807