Google L3 TPS | Reject

Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2025-04-25Added By Anonymous
Source:Ā Link
🧭 Experience: The candidate describes their experience solving a grid-based problem during a Google interview, including the initial discussion, coding, and dry-running the algorithm. They also mention receiving negative feedback for being slow and requiring many hints. āœ… Outcome: Reject šŸ“ Location: unknown šŸ¢ Company: Google Q. Given a grid of m*n of 0's & 1's. Find the maximum area of triangle Example 0 1 0 1 0 1 1 0 0 1 1 1 0 1 1 0 Ans = 6 * Consider Triangle to downward increasing and height and width of triangle is same (think of it as half square) * both sides to be parallel to x & y axis Asked some clarifying question. Talked abrout brute force with O(n^4) and quickly jumped to optimized My Code: ``` int getmaxSideTriangle(vector<vector<int>> &grid,vector<vector<int>> &memo,int i, int j){ int m = grid.size(); int n = grid[0].size(); if(i<0 || j<0 ||i >m-1 ||j>n-1)return 0; if(grid[i][j]==0)return memo[i][j]=0; if(memo[i][j]!=-1)return memo[i][j]; int down = getmaxSideTriangle(grid,memo,i+1,j); int diagnal = getmaxSideTriangle(grid,memo,i+1,j+1); return memo[i][j] = 1+min(down,diagnal); } int maxArea(vector<vector<int>> grid){ int m = grid.size(); int n = grid[0].size(); int maxArea=0; vector<vector<int>> memo(m,vector<int>(n,-1)); for(int i=0;i<m;i++){ for(int j=0;j<n;j++){ if(grid[i][j]){ int side = getmaxSideTriangle(grid,memo,i,j); int area = side*side/2; maxArea = max(area,maxArea); } } } return maxArea; } int main() { vector<vector<int>> grid = { {0 ,1, 0, 1}, {0, 1, 1, 0}, {0, 1, 1, 1}, {0, 1, 1, 0} }; cout<<maxArea(grid); } ``` my area calculation is wrong - The area is 6 but this is returning 4 Any way i thought i came up with a decent solution but apprently not Recruiter said feeback was not positive as i was slow & took many hints Interviewer barely gave any hints , and i finished up code in 10-15 mins after intial discussion and everything The rest of the time we just dry ran the algo Thoughts on rejection? Edit: Is my approach incorrect? if it was? shouldn't the interviewer should've given any hints or asked more questions?
Comments