Recently interviewed for a front end developer position where I had no less than 6 rounds through Mphesis.
The job required relocation, and a lower salary then I was used to.
The first was a verbal technical screening on how to optimize ReactJS front ends.
The second round was a test with questions coming from the website BFE.dev.
Then I had to meet with managers at least twice who kept asking me if I was sure I was ready to relocate back to Sunnyvale.
Then I met with an Apple employee and went through my experience and talked about various technical challenges.
Last but not least, was a … LEETCODE ROUND.
This is the question I failed:
https://leetcode.com/problems/search-a-2d-matrix/
And below the solution in C++
class Solution {
public:
bool searchMatrix(vector<vector<int>>& matrix, int target) {
int rows = matrix.size()-1;
int cols = matrix[0].size()-1;
int startRow = rows;
int startCol = 0;
while(true){
if( startRow < 0 || startCol > cols )
break;
int currentVal = matrix[startRow][startCol];
if( currentVal == target)
return true;
else if( currentVal > target )
startRow--;
else if( currentVal < target )
startCol++;
}
return false;
}
};
There was one other one which I was able to do and that was:
https://leetcode.com/problems/container-with-most-water/
class Solution {
public int maxArea(int[] height) {
int i = 0;
int j = height.length - 1;
int container = 0;
int h = 0;
while(i<j){
h = Math.min(height[i],height[j]);
container = Math.max(container,(j-i)*h);
while(i<j && height[i]<=h)
i++;
while(i<j && height[j]<=h)
j--;
}
return container;
}
}