Zscaler visited on 12th august 2020 CTC 17 LPA Online Round 4 coding questions (only C Language allowed) The questions were pretty straight forward The only tricky part was you needed to implement your own sort and hashing functions
Around 20 were shortlisted from 600 candidates.
Started with rapid fire of OS/CN/OOPS and then 2 coding questions :-
The interviewer began with "I have received a feedback from previous interviewer that you are good at problem solving so we will do 1 coding question and if you do good you will make it."
Here is the one question we discussed:-
Sample Input
aabbccaaa
Sample Output
a2b2c2a3
I got stuck on an edge case and alas rejected.
They finally made offers to 2 students.
Overview
Approach
Time Complexity
PseudoCode
int curr=0;
int min_sum = INT_MAX;
for(int i=0;i < k;i++){
curr+=a[i];
}
min_sum=min(curr,min_sum);
for(int i=k;i < n;i++){
curr-=a[i-k];
curr+=a[i];
min_sum=min(curr,min_sum);
}
answer for question 2;
public String compress(String s) {
String out = “”;
int sum = 1;
for (int i = 0; i < s.length() - 1; i++) {
if (s.charAt(i) == s.charAt(i+1)) {
sum++;
} else {
out = out + s.charAt(i) + sum;
sum = 1;
}
}
out = out + s.charAt(s.length() - 1) + sum;
return out.length() < s.length() ? out : s;
}