Tip 1 : Practice Data Structures daily as they are the key.
Tip 2 : Please reflect on Interview Experiences of your seniors
Tip 3 : Make a good project.
Tip 1 : Mention some good project
Tip 2 : Mention skills like C++, Database, HTML, CSS, JS
The tests were carried out online on the Microsoft platform. Since there were only two coding questions in this round and almost all students asked both questions, the final selection was based on resumes (mainly CGPA).



“{}{}”, “{{}}”, “{{}{}}” are valid strings while “}{}”, “{}}{{}”, “{{}}}{“ are not valid strings.
Minimum operations to make ‘STR’ = “{{“ valid is 1.
In one operation, we can convert ‘{’ at index ‘1’ (0-based indexing) to ‘}’. The ‘STR’ now becomes "{}" which is a valid string.
Return -1 if it is impossible to make ‘STR’ valid.
We will traverse the string from left to right. For each substring that contains the same characters, we calculate the sum of the costs and the maximum cost mx. We add sum-mx to the answer.
I have attached the code for reference:
class Solution {
public:
int minCost(string s, vector& cost) {
int i = 0, N = s.size(), ans = 0;
while (i < N) {
int j = i, sum = 0, mx = 1;
for (; i < N && s[i] == s[j]; ++i) sum += cost[i], mx = max(mx, cost[i]);
ans += sum - mx;
}
return ans;
}
};



Interviews were held after OA and 20 students were shortlisted (I was one of them). It was morning and I was on campus, so it was the same from the university's training and placement cells.



bool isBadVersion(version) returns true for all versions ‘V’ such that V > X, where X is the first bad version.
It was a very simple binary search problem, I initially told the interviewer about my approach. The first approach was Brute force that is linear seach after which he asked me to optimize it and then i told him about muy approach of linear search to reduce complexity and he asked me to code it.
I have attached it for reference:
bool isBadVersion(int version);
class Solution {
public:
int firstBadVersion(int n) {
int l = 1, r = n;
while (l < r) {
int m = l + (r - l) / 2;
if (isBadVersion(m)) r = m; else l = m + 1;
}
return l;
}
};



The width of each bar is the same and is equal to 1.
Input: ‘n’ = 6, ‘arr’ = [3, 0, 0, 2, 0, 4].
Output: 10
Explanation: Refer to the image for better comprehension:

You don't need to print anything. It has already been taken care of. Just implement the given function.

Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
How do you remove whitespace from the start of a string?