Oncampus Round
CGPA Cutoff - 7.5
Branches Allowed - Circuital
Offer type - Intern + Full time opportunity
CTC - 15 LPA and Base Pay - 12 LPA
Here I am sharing the interview experience of my friend who recently appeared for Sigmoid On-campus placement and got selected.
Question 1
The first question was to find the maximum and minimum elements in the sorted rotated array. The interviewer asked for the most optimized approach.
Question 2
Check whether a tree is binary search tree or not.
The question I asked at the end of the interview in QnA was:-Sigmoid has a learning plan for the freshers so I asked questions regarding that.
Round 3: The next round was a technical interview round . It went off for around 1 hour. Then Interviewer directly started with the DSA questions and in total 2 questions were asked in nearly 45 minutes. Level - Medium
Question 1 : Based on tree and asked to find the sum of left subtree.
Question 2 : Couldn't remember the exact question but was based on greedy and matrix (Kind of rotten tomatoes problem) .
The question I asked at the end of the interview in QnA was:-Sigmoid has a learning plan for the freshers so I asked questions regarding that.
Tips And Unique Points from Interview.
Time Complexity: O(logN), N
is the size of the array.
int solve(vector<vector<int>> grid) {
int n=grid.size(),m=grid[0].size();
queue<pair<int,int>> q;
vector<int> dx={1,-1,0,0};
vector<int> dy={0,0,1,-1};
vector<vector<int>> v(n,vector<int> (m,-1));
for(int i = 0;i < n;i++)
{
for(int j = 0;j < m;j++)
{
if(grid[i][j]==2){
q.push({i,j});
v[i][j]=0;
}
}
}
while(!q.empty())
{
auto x=q.front();
q.pop();
for(int l = 0;l < 4;l++)
{
int ni=x.first+dx[l],nj=x.second+dy[l];
if(ni<0||ni>=n||nj<0||nj>=m)
continue;
if(v[ni][nj]!=-1)
continue;
if(grid[ni][nj]==0)
continue;
v[ni][nj]=v[x.first][x.second]+1;
q.push({ni,nj});
}
}
int ans=0;
for(int i = 0;i < n;i++)
{
for(int j = 0;j < m;j++)
{
if(grid[i][j]==1&&v[i][j]==-1)
return -1;
if(grid[i][j]!=0)
ans=max(ans,v[i][j]);
}
}
return ans;
}
Time complexity: O(M*N)
Inside the for loop, where you have written
it would produce wrong result as other rotten tomatoes might reach there first, so you should check
and then update v[ni][nj] and push in queue