Add office photos
Employer?
Claim Account for FREE

Adobe

3.9
based on 1.1k Reviews
Video summary
Filter interviews by

20+ Zydus Lifesciences Interview Questions and Answers

Updated 5 Feb 2024
Popular Designations

Q1. Minimum Cost to Make String Valid

Given a string containing only '{' and '}', determine the minimum cost required to make the string valid. A string is considered valid if for every opening bracket '{', there i...read more

Ans.

Given a string with only '{' and '}', find the minimum cost to make it valid by converting brackets.

  • Iterate through the string and keep track of the opening and closing brackets

  • If there are more closing brackets than opening brackets, convert the excess closing brackets to opening brackets

  • If there are more opening brackets than closing brackets, convert the excess opening brackets to closing brackets

  • Return the total cost of conversions needed to make the string valid

Add your answer

Q2. Prime with 3 Factors Problem Statement

You are provided with an array ARR consisting of 'N' positive integers. Your task is to determine if each number in the array ARR has exactly 3 factors.

You need to return...read more

Ans.

Determine if each number in the array has exactly 3 factors.

  • Iterate through each number in the array and check if it has exactly 3 factors.

  • Factors of a number can be found by iterating from 1 to the square root of the number.

  • Count the number of factors and return 1 if it is exactly 3, else return 0.

Add your answer

Q3. Search in a Row-wise and Column-wise Sorted Matrix Problem Statement

You are given an N * N matrix of integers where each row and each column is sorted in increasing order. Your task is to find the position of ...read more

Add your answer

Q4. Kevin and His Cards Problem Statement

Kevin has two packs of cards. The first pack contains N cards, and the second contains M cards. Each card has an integer written on it. Determine two results: the total num...read more

Add your answer
Discover Zydus Lifesciences interview dos and don'ts from real experiences

Q5. Tiling Problem Statement

Given a board with 2 rows and N columns, and an infinite supply of 2x1 tiles, determine the number of distinct ways to completely cover the board using these tiles.

You can place each t...read more

Add your answer

Q6. Count Distinct Substrings

You are provided with a string S. Your task is to determine and return the number of distinct substrings, including the empty substring, of this given string. Implement the solution us...read more

Ans.

Count distinct substrings of a given string using trie data structure.

  • Implement a trie data structure to store all substrings of the given string.

  • Count the number of nodes in the trie to get the distinct substrings count.

  • Handle empty string case separately.

  • Example: For 'ab', distinct substrings are: '', 'a', 'b', 'ab'.

Add your answer
Are these interview questions helpful?

Q7. Chocolate Distribution Problem

You are given an array/list CHOCOLATES of size 'N', where each element represents the number of chocolates in a packet. Your task is to distribute these chocolates among 'M' stude...read more

Add your answer

Q8. Wildcard Pattern Matching Problem Statement

Implement a wildcard pattern matching algorithm to determine if a given wildcard pattern matches a text string completely.

The wildcard pattern may include the charac...read more

Ans.

Implement a wildcard pattern matching algorithm to determine if a given wildcard pattern matches a text string completely.

  • Create a recursive function to match the pattern with the text character by character.

  • Handle cases for '?' and '*' characters separately.

  • Use dynamic programming to optimize the solution.

  • Check for edge cases like empty pattern or text.

Add your answer
Share interview questions and help millions of jobseekers 🌟

Q9. Maximum Frequency Number Problem Statement

Given an array of integers with numbers in random order, write a program to find and return the number which appears the most frequently in the array.

If multiple elem...read more

Ans.

Find the number with the maximum frequency in an array of integers.

  • Iterate through the array and keep track of the frequency of each number using a hashmap.

  • Find the number with the maximum frequency and return it.

  • If multiple elements have the same maximum frequency, return the one that appears first in the array.

Add your answer

Q10. Rat In a Maze Problem Statement

Given a N * N maze with a rat placed at position MAZE[0][0], find and print all possible paths for the rat to reach its destination at MAZE[N-1][N-1]. The rat is allowed to move ...read more

Ans.

Find all possible paths for a rat in a maze to reach its destination.

  • Implement a backtracking algorithm to explore all possible paths in the maze.

  • Keep track of the current path and mark visited cells to avoid loops.

  • Return the paths that lead from the start position to the destination.

  • Example: [[1, 0, 0], [1, 1, 0], [0, 1, 1]]

Add your answer

Q11. Min Jumps Problem Statement

In Ninja town, represented as an N * M grid, people travel by jumping over buildings in the grid's cells. Santa is starting at cell (0, 0) and must deliver gifts to cell (N-1, M-1) o...read more

Ans.

Santa needs to find the quickest path to deliver gifts in Ninja town by jumping over buildings with least travel time.

  • Santa can jump to (x+1, y+1), (x+1, y), or (x, y+1) from any cell (x, y) within grid boundaries.

  • The travel time between two buildings equals the absolute difference in their heights.

  • Find the shortest path from (0, 0) to (N-1, M-1) using dynamic programming or Dijkstra's algorithm.

  • Consider all possible paths and choose the one with the minimum total travel time...read more

Add your answer

Q12. Zigzag Binary Tree Traversal Problem Statement

Determine the zigzag level order traversal of a given binary tree's nodes. Zigzag traversal alternates the direction at each level, starting from left to right, th...read more

Ans.

Zigzag level order traversal of a binary tree alternating direction at each level.

  • Use a queue to perform level order traversal of the binary tree.

  • Maintain a flag to alternate the direction of traversal at each level.

  • Store nodes at each level in separate lists and reverse the list if traversal direction is right to left.

Add your answer

Q13. Digit Count In Range Problem Statement

Given an integer K, and two numbers A and B, count the occurrences of the digit K in the range [A, B].

Include both the lower and upper limits in the count.

Input:

The fir...read more
Ans.

Count occurrences of a digit in a given range.

  • Iterate through the range [A, B] and count occurrences of digit K.

  • Convert integers to strings for easier digit comparison.

  • Handle edge cases like when A or B is equal to K.

Add your answer

Q14. Tree Symmetricity Problem Statement

You are provided with a binary tree structure, where each node consists of an integer value. Your task is to determine whether this binary tree is symmetric.

A symmetric tree...read more

Ans.

Determine if a binary tree is symmetric by checking if its left and right subtrees are mirror images of each other.

  • Check if the left and right subtrees of the root node are mirror images of each other

  • Recursively check if the left subtree of the left child is a mirror image of the right subtree of the right child, and vice versa

  • Base case: If both nodes are null, return true; If one node is null and the other is not, return false

  • Example: For the input tree 1 2 2 3 4 4 3, the tr...read more

Add your answer

Q15. Print Binary Tree Representation

Given a binary tree of integers, your task is to represent the binary tree in a 2-D array of strings with specific formatting rules.

Specifications:

  • There should be ‘H’ number ...read more
Ans.

The task is to represent a binary tree in a 2-D array of strings with specific formatting rules.

  • Create a 2-D array of strings with 'H' rows and odd number of columns.

  • Fill in the array based on the given binary tree, following the specified formatting rules.

  • Leave empty strings for unfilled cells and adjust spacing for empty subtrees.

  • Ensure the output matches the example provided in the question.

Add your answer

Q16. K-Sum Path in a Binary Tree Problem Statement

You are presented with a binary tree where each node holds an integer, along with a specified number 'K'. The task is to identify and print every path that exists w...read more

Ans.

The task is to identify and print every path in a binary tree whose node values sum up to a specified number 'K'.

  • Traverse the binary tree to find paths with sum equal to 'K'.

  • Print each valid path in the order encountered in the tree.

  • Handle cases where nodes may have missing children (-1).

Add your answer

Q17. Search In Rotated Sorted Array Problem Statement

Given a rotated sorted array ARR of size 'N' and an integer 'K', determine the index at which 'K' is present in the array.

Note:
1. If 'K' is not present in ARR,...read more
Ans.

Given a rotated sorted array, find the index of a given integer 'K'.

  • Perform binary search to find the pivot point where the array is rotated.

  • Based on the pivot point, apply binary search on the appropriate half of the array to find 'K'.

  • Handle cases where 'K' is not present in the array by returning -1.

Add your answer

Q18. Unbounded Knapsack Problem Statement

Given ‘N’ items, each with a specific profit and weight, and a knapsack with a weight capacity ‘W’. The objective is to fill the knapsack such that the total profit is maxim...read more

Ans.

The Unbounded Knapsack Problem involves maximizing profit by filling a knapsack with items of specific profit and weight.

  • Iterate through each item and calculate the maximum profit that can be obtained by including or excluding the item in the knapsack.

  • Use dynamic programming to store and reuse subproblem solutions to optimize the solution.

  • The final answer will be the maximum profit that can be obtained by filling the knapsack with the given items.

Add your answer

Q19. Missing Numbers Problem Statement

You are provided with an array called ARR, consisting of distinct positive integers. Your task is to identify all the numbers that fall within the range of the smallest and lar...read more

Ans.

Identify missing numbers within the range of smallest and largest elements in an array.

  • Find the smallest and largest elements in the array.

  • Generate a list of numbers within this range.

  • Remove numbers that are present in the array.

  • Sort and return the missing numbers.

Add your answer

Q20. Count Subarrays Problem

You are given an array or list consisting of 0s and 1s only. Your task is to find the sum of the number of subarrays that contain only 1s and the number of subarrays that contain only 0s...read more

Ans.

Count the number of subarrays containing only 1s and 0s in a given array of 0s and 1s.

  • Iterate through the array and count consecutive 1s and 0s separately.

  • Use two variables to keep track of the count of 1s and 0s subarrays.

  • Add the counts of 1s and 0s subarrays to get the final result.

Add your answer
Q21. What is heap sort and what is its complexity?
Ans.

Heap sort is a comparison-based sorting algorithm that uses a binary heap data structure to sort elements in ascending or descending order.

  • Heap sort works by first building a max heap from the input array, then repeatedly removing the largest element from the heap and placing it at the end of the array.

  • The complexity of heap sort is O(n log n) for both time and space, making it efficient for large datasets.

  • Example: Given an array [4, 2, 7, 1, 5], after applying heap sort, the...read more

Add your answer
Q22. Design a parking lot system.
Ans.

Design a parking lot system with features like ticketing, availability tracking, and payment options.

  • Create a database to store information about parking spots, availability, and pricing

  • Implement a ticketing system to assign and track parking spots for each vehicle

  • Include sensors or cameras to monitor spot availability in real-time

  • Offer payment options such as cash, credit card, or mobile payment apps

Add your answer
Contribute & help others!
Write a review
Share interview
Contribute salary
Add office photos
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Software Developer Intern Interview Questions from Similar Companies

4.1
 • 188 Interview Questions
3.0
 • 35 Interview Questions
3.8
 • 21 Interview Questions
1.9
 • 11 Interview Questions
3.7
 • 10 Interview Questions
3.7
 • 10 Interview Questions
View all
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
75 Lakh+

Reviews

5 Lakh+

Interviews

4 Crore+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter