Entering edit mode

**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.

- Round 1: The First round was an Online Assessment Round in which 20 mcq and 2 coding questions were asked on HackerEarth .

- Round 2: The next round was a technical interview round . It went off for around 1 hour. The interview started with basic introduction and little bit about my projects. Then Interviewer directly started with the DSA questions and in total 2 questions were asked in nearly 45 minutes.
**Level - Medium**

Question 1

Click here to Practice

Submit Problem to OJ

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) .

Click here to PracticeSubmit Problem to OJThe 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 4: The next round was the Managerial round. It went off for around 10 min. Asked questions like apart from dsa skills what knowledge do you have in the Data Engineering field?

- Round 5: The next round was with the VP of the company. It went off for around 10 min. Asked questions based on my journey till now etc.

**Tips And Unique Points from Interview.**

- They asked mostly questions on DSA so write clean and understandable code and keep your fundamentals clear.
- Also maintain good soft skills.

Entering edit mode

- Find the minimum and maximum elements for a given sorted rotated array.

- Looking at subarray with index [start, end]. We can find out that if the first member is less than the last member, there's no rotation in the array. We could directly return the first element in this subarray.
- If the first element is larger than the last one, then we compute the element in the middle and compare it with the first element. If the value of the element in the middle is larger than the first element, we know the rotation is at the second half of this array. Else, it is in the first half of the array.
- Now observe that the element to the right of the max element is the min (or none if the array is not rotated at all).

Time Complexity: `O(logN), N`

is the size of the array.

Entering edit mode

- For rotten oranges problem, we are given a grid of 0/1/2, where 0 denotes empty cell, 1 denotes fresh orange and 2 denotes rotten orange.
- Every minute, any fresh orange that is 4-directionally adjacent to a rotten orange becomes rotten.
- Find the minimum number of minutes that must elapse until no cell has a fresh orange. If this is impossible, return -1.

- This can be solved easily using multi-source bfs, where we put every '2' in our queue and do bfs from that.
- If any '1' is not reachable, answer will be -1 else answer will be maximum distance to a 1.

```
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