Cracking Zoho’s coding round is tough. You practise hard, but still feel unsure. You need clear examples and solutions.
This article gives you exactly that. It lists common Zoho coding questions. Each question has a detailed answer. Use this article to practise, learn, and boost your confidence for the Zoho interview.
Zoho Coding Interview Process
This section will tell you about the structure of the Zoho coding interview. You will learn about the different rounds and what to expect in each round.
General Overview of the Zoho Interview Process
The Zoho interview process tests your skills in multiple areas. It typically includes a few rounds. The first round often checks your aptitude and basic programming knowledge. This round includes questions on reasoning, aptitude, and simple coding problems.
The next round focuses on coding. You will solve more complex coding problems here. Interviewers assess your problem-solving skills, coding ability, and understanding of data structures and algorithms.
The final round is usually an HR round. This round checks your fit with the company culture and your communication skills.
Importance of Problem-Solving and Coding Skills
Problem-solving and coding skills are very important at Zoho. These skills help you build good software. Zoho values people who can think critically and write clean code. Good problem-solving skills help you break down complex problems into smaller parts. Strong coding skills help you write efficient and readable code.
Types of Coding Questions Asked at Zoho
Zoho asks a variety of coding questions. These questions test your knowledge of different areas.
- Data Structures: You should know data structures like arrays, linked lists, stacks, queues, trees, and graphs. Interviewers often ask questions that require you to use these structures efficiently.
- Algorithms: Understanding algorithms is crucial. You should practise algorithms like searching, sorting, dynamic programming, and greedy algorithms. These algorithms form the building blocks for solving many coding problems.
- Problem-Solving: Zoho values your ability to approach problems logically. You should practise breaking down problems into smaller steps. Write clean and efficient code to solve these problems.
Overall, the Zoho interview process focuses on your problem-solving and coding abilities. Strong fundamentals in data structures and algorithms will help you perform well. Practice coding regularly and participate in coding challenges to improve your skills.
Now that you understand the process, let’s look at some common coding questions asked in Zoho interviews.
Zoho Coding Interview Questions with Solutions
Here, you will find sample coding questions asked in Zoho interviews. We will also provide solutions to help you understand the problem-solving approach.
Question 1: Count Heads in Coin Tosses
Problem: Write a function count_heads(N, R) that returns the probability of getting exactly R heads in N tosses of a fair coin.
Solution:
cpp
#include <bits/stdc++.h>
using namespace std;
double comb(int n, int r) {
if (r == 0) return 1;
return n * comb(n – 1, r – 1) / r;
}
int main() {
int n, r;
cin >> n >> r;
cout << comb(n, r) / (1 << n);
}
Question 2: Remove Vowels from String
Problem: Write a program to remove vowels from a string. If two or more vowels occur together, ignore all of them.
Solution:
cpp
#include <bits/stdc++.h>
using namespace std;
bool isVowel(char c) {
char lowercase = tolower(c);
return lowercase == ‘a’ || lowercase == ‘e’ || lowercase == ‘i’ || lowercase == ‘o’ || lowercase == ‘u’;
}
string removeVowels(const string& input) {
string result = “”;
for (char c : input) {
if (!isVowel(c)) {
result += c;
}
}
return result;
}
int main() {
string input;
cin >> input;
string result = removeVowels(input);
cout << result << endl;
return 0;
}
Question 3: Balanced Parentheses
Problem: Check if every left parenthesis has a matching right parenthesis.
Solution:
cpp
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
int c = 0;
getline(cin, s);
for (auto i : s) {
if (i == ‘(‘) c++;
if (i == ‘)’) c–;
}
cout << (c == 0);
}
Question 4: Sort Strings by Word Occurrences
Problem: Given a word A and several texts, output the texts in ascending order of occurrences of word A.
Solution:
cpp
#include <bits/stdc++.h>
using namespace std;
int countOccurrences(const string& text, const string& word) {
int count = 0;
size_t pos = text.find(word);
while (pos != string::npos) {
count++;
pos = text.find(word, pos + word.length());
}
return count;
}
int main() {
int M;
cin >> M;
string word;
cin >> word;
vector<string> texts(M);
for (int i = 0; i < M; i++) {
cin.ignore();
getline(cin, texts[i]);
}
sort(texts.begin(), texts.end(), [&](const string& a, const string& b) {
return countOccurrences(a, word) < countOccurrences(b, word);
});
for (const auto& text : texts) {
cout << text << endl;
}
}
Question 5: Expand Encoded Strings
Problem: Given a string with characters followed by numbers (e.g., a1b10), expand it to abbbbbbbbbb.
Solution:
cpp
#include <bits/stdc++.h>
using namespace std;
string expandString(const string& input) {
string result = “”;
for (int i = 0; i < input.size(); i++) {
char c = input[i];
i++;
string number = “”;
while (i < input.size() && isdigit(input[i])) {
number += input[i];
i++;
}
i–; // Adjust for the outer loop increment
int count = stoi(number);
result += string(count, c);
}
return result;
}
int main() {
string input;
cin >> input;
cout << expandString(input);
}
Question 6: Sort Odd and Even Indices
Problem: Sort elements at odd indices in descending order and even indices in ascending order.
Solution:
cpp
#include <bits/stdc++.h>
using namespace std;
void sortOddEven(vector<int>& arr) {
vector<int> odd, even;
for (int i = 0; i < arr.size(); i++) {
if (i % 2 == 0) even.push_back(arr[i]);
else odd.push_back(arr[i]);
}
sort(even.begin(), even.end());
sort(odd.rbegin(), odd.rend());
for (int i = 0; i < arr.size(); i++) {
arr[i] = (i % 2 == 0) ? even[i / 2] : odd[i / 2];
}
}
int main() {
vector<int> arr = {13, 2, 4, 15, 12, 10, 5};
sortOddEven(arr);
for (int num : arr) cout << num << ” “;
}
Question 7: Substring Search
Problem: Check if a string is a substring of another and return the index or -1.
Solution:
cpp
#include <bits/stdc++.h>
using namespace std;
int findSubstring(const string& str1, const string& str2) {
size_t pos = str1.find(str2);
return (pos != string::npos) ? pos : -1;
}
int main() {
string str1, str2;
cin >> str1 >> str2;
cout << findSubstring(str1, str2);
}
Question 8: Reverse Words in a Sentence
Problem: Reverse the words in a given sentence.
Solution:
cpp
#include <bits/stdc++.h>
using namespace std;
string reverseWords(const string& s) {
stringstream ss(s);
string word, result;
while (ss >> word) {
result = word + ” ” + result;
}
return result.empty() ? result : result.substr(0, result.size() – 1);
}
int main() {
string input;
getline(cin, input);
cout << reverseWords(input);
}
Question 9: Anagram Check
Problem: Check if two strings are anagrams of each other.
Solution:
cpp
#include <bits/stdc++.h>
using namespace std;
bool areAnagrams(const string& str1, const string& str2) {
if (str1.length() != str2.length()) return false;
unordered_map<char, int> count;
for (char c : str1) count[c]++;
for (char c : str2) {
if (–count[c] < 0) return false;
}
return true;
}
int main() {
string str1, str2;
cin >> str1 >> str2;
cout << (areAnagrams(str1, str2) ? “Yes” : “No”);
}
Question 10: Find Missing Number
Problem: Find the missing number in a given array containing 1 to N.
Solution:
cpp
#include <bits/stdc++.h>
using namespace std;
int findMissingNumber(const vector<int>& arr, int N) {
int total = N * (N + 1) / 2;
int sum = accumulate(arr.begin(), arr.end(), 0);
return total – sum;
}
int main() {
vector<int> arr = {1, 2, 4, 5}; // Missing 3
cout << findMissingNumber(arr, 5);
}
Question 11: Check Palindrome
Problem: Check if a string is a palindrome.
Solution:
cpp
#include <bits/stdc++.h>
using namespace std;
bool isPalindrome(const string& str) {
int left = 0, right = str.length() – 1;
while (left < right) {
if (str[left] != str[right]) return false;
left++;
right–;
}
return true;
}
int main() {
string input;
cin >> input;
cout << (isPalindrome(input) ? “Yes” : “No”);
}
Question 12: Fibonacci Series
Problem: Generate Fibonacci series up to N terms.
Solution:
cpp
#include <bits/stdc++.h>
using namespace std;
void fibonacci(int N) {
int a = 0, b = 1;
for (int i = 0; i < N; i++) {
cout << a << ” “;
int next = a + b;
a = b;
b = next;
}
}
int main() {
int N;
cin >> N;
fibonacci(N);
}
Question 13: Find the Factorial
Problem: Calculate the factorial of a number.
Solution:
cpp
#include <bits/stdc++.h>
using namespace std;
long long factorial(int n) {
return (n <= 1) ? 1 : n * factorial(n – 1);
}
int main() {
int n;
cin >> n;
cout << factorial(n);
}
Question 14: Merge Two Sorted Arrays
Problem: Merge two sorted arrays into one sorted array.
Solution:
cpp
#include <bits/stdc++.h>
using namespace std;
vector<int> mergeSortedArrays(const vector<int>& arr1, const vector<int>& arr2) {
vector<int> merged(arr1.size() + arr2.size());
merge(arr1.begin(), arr1.end(), arr2.begin(), arr2.end(), merged.begin());
return merged;
}
int main() {
vector<int> arr1 = {1, 3, 5};
vector<int> arr2 = {2, 4, 6};
vector<int> merged = mergeSortedArrays(arr1, arr2);
for (int num : merged) cout << num << ” “;
}
Question 15: Rotate Array
Problem: Rotate an array to the right by K steps.
Solution:
cpp
#include <bits/stdc++.h>
using namespace std;
void rotateArray(vector<int>& arr, int k) {
int n = arr.size();
k = k % n; // In case k is greater than n
reverse(arr.begin(), arr.end());
reverse(arr.begin(), arr.begin() + k);
reverse(arr.begin() + k, arr.end());
}
int main() {
vector<int> arr = {1, 2, 3, 4, 5};
int k = 2;
rotateArray(arr, k);
for (int num : arr) cout << num << ” “;
}
These questions and solutions provide a solid foundation for preparing for coding interviews at Zoho, covering essential programming concepts and problem-solving techniques.
Tips for preparing for the Zoho coding interview
This part offers advice on how to prepare for your Zoho coding interview. You will find tips on improving your coding skills and interview performance.
Arrays
Arrays are a fundamental data structure. Practice searching for elements within an array. Learn different sorting algorithms like bubble sort, insertion sort, selection sort, merge sort, and quick sort. Understand array manipulation techniques such as reversing and rotating arrays. Solve common problems like finding the sum of two numbers that equal a target value and determining the maximum subarray sum.
Linked Lists
Linked lists are another essential data structure. Master reversing linked lists. Practice inserting and deleting nodes at different positions. Learn to merge two sorted linked lists. Understand cycle detection techniques like Floyd’s cycle detection algorithm. Practice checking if a linked list is a palindrome.
Stacks and Queues
Grasp the concept of stacks and queues. Understand their implementations using arrays or linked lists. Practice problems involving stack operations like balancing parentheses and evaluating expressions. Solve queue-based problems like implementing a queue using stacks and level order traversal of a tree.
Trees
Focus on binary trees and binary search trees. Learn different tree traversals: inorder, preorder, and postorder. Practice tree construction from given data. Master searching for elements in a binary search tree. Understand tree modification operations like insertion and deletion.
Graphs
Study graph representations using adjacency matrices and adjacency lists. Learn graph traversal algorithms: breadth-first search (BFS) and depth-first search (DFS). Practice implementing these algorithms. Understand shortest path algorithms like Dijkstra’s algorithm for finding the shortest path between nodes and Bellman-Ford algorithm for handling negative edge weights.
Conclusion
You now have a good base to prepare for your Zoho coding interview. Practice makes perfect. This article gave you example questions and answers.
But remember, real interviews have different questions. To boost your confidence, try iScalePro. It offers many practice questions and helps you improve your coding skills. Prepare well, practise hard, and ace your Zoho interview!
Zoho Coding Interview FAQs
1) How to prepare for Zoho coding round?
To prepare for the Zoho coding round, focus on these areas:
- Data structures and algorithms: Practice solving problems using arrays, linked lists, stacks, queues, trees, graphs, and sorting and searching algorithms.
- Programming languages: Choose a language you’re comfortable with, such as C++, Java, Python, or JavaScript.
- Problem-solving: Practice solving coding problems on platforms like LeetCode, HackerRank, and CodeChef.
- Zoho specific questions: Look for past Zoho interview questions and practice solving them.
- Time management: Learn to solve problems efficiently within the given time limit.
2) Is Zoho exam tough?
The difficulty of the Zoho coding exam varies. Some candidates find it easy, while others find it challenging. The difficulty level depends on your preparation and problem-solving skills.
3) What type of questions are asked in Zoho?
Zoho asks questions on:
- Data structures and algorithms: You may be asked to implement data structures or algorithms from scratch, or use them to solve problems.
- Problem-solving: You may be given coding problems that require you to think logically and come up with efficient solutions.
- Coding best practices: Zoho may evaluate your code for readability, maintainability, and efficiency.
4) What are the 5 rounds in Zoho?
The Zoho recruitment process typically involves 5 rounds:
- Online coding assessment: This is the first round where you’ll be given coding problems to solve.
- Technical interview: If you pass the coding assessment, you’ll have a technical interview to discuss your solutions and ask technical questions.
- HR interview: This round is to assess your fit for the company culture and role.
- Group discussion: You may be asked to participate in a group discussion on a given topic.
- Final interview: This is the final round where you may meet with senior management.
5) Which programming language is used in Zoho?
Zoho primarily uses Java for its internal development. However, you can use any programming language you’re comfortable with for the coding assessment.