BNY
Cipla Interview Questions and Answers
Q1. Ways To Make Coin Change
Given an infinite supply of coins of varying denominations, determine the total number of ways to make change for a specified value using these coins. If it's not possible to make the c...read more
The task is to find the total number of ways to make change for a specified value using given denominations.
Use dynamic programming to keep track of the number of ways to make change for each value up to the target value.
Iterate through each denomination and update the number of ways to make change for each value based on the current denomination.
The final answer will be the number of ways to make change for the target value.
Consider edge cases such as when the target value i...read more
Q2. Minimum Operations Problem Statement
You are given an array 'ARR'
of size 'N'
consisting of positive integers. Your task is to determine the minimum number of operations required to make all elements in the arr...read more
The minimum operations problem involves finding the minimum number of operations required to make all elements in an array equal.
Iterate through the array to find the maximum and minimum values.
Calculate the difference between the maximum and minimum values.
The minimum number of operations needed is the difference between the maximum and minimum values.
Q3. Count Ways to Reach the N-th Stair Problem Statement
You are provided with a number of stairs, and initially, you are located at the 0th stair. You need to reach the Nth stair, and you can climb one or two step...read more
The problem involves finding the number of distinct ways to climb N stairs by taking 1 or 2 steps at a time.
Use dynamic programming to solve the problem efficiently.
The number of ways to reach the Nth stair is the sum of the number of ways to reach the (N-1)th stair and the (N-2)th stair.
Handle base cases for N=0 and N=1 separately.
Consider using modulo operation to avoid overflow when dealing with large numbers.
Q4. Merge Sort Problem Statement
You are given a sequence of numbers, ARR
. Your task is to return a sorted sequence of ARR
in non-descending order using the Merge Sort algorithm.
Explanation:
The Merge Sort algorit...read more
Implement Merge Sort algorithm to sort a sequence of numbers in non-descending order.
Implement the Merge Sort algorithm which recursively divides the input array into two halves and then merges them in sorted order.
Ensure the base case of the recursion is when the size of the array is 1.
Time complexity of Merge Sort is O(n log n) and space complexity is O(n).
Example: For input [3, 1, 4, 1, 5], the output should be [1, 1, 3, 4, 5].
Q5. Cycle Detection in a Singly Linked List
Determine if a given singly linked list of integers forms a cycle or not.
A cycle in a linked list occurs when a node's next
points back to a previous node in the list. T...read more
Detect if a singly linked list forms a cycle by checking if a node's next pointer points back to a previous node.
Use Floyd's Tortoise and Hare algorithm to detect a cycle in the linked list.
Initialize two pointers, slow and fast, and move them at different speeds through the list.
If there is a cycle, the fast pointer will eventually meet the slow pointer.
If the fast pointer reaches the end of the list (null), there is no cycle.
Time complexity: O(N), Space complexity: O(1)
Q6. Merge Two Sorted Linked Lists Problem Statement
You are provided with two sorted linked lists. Your task is to merge them into a single sorted linked list and return the head of the combined linked list.
Input:...read more
Merge two sorted linked lists into a single sorted linked list without using additional space.
Create a dummy node to start the merged list
Compare the values of the two linked lists and add the smaller value to the merged list
Move the pointer of the merged list and the respective linked list with the smaller value
Continue this process until one of the linked lists is fully traversed
Append the remaining elements of the other linked list to the merged list
Q7. Pattern Matching Problem Statement
Given a pattern as a string and a set of words, determine if the pattern and the words list align in the same sequence.
Input:
T (number of test cases)
For each test case:
patte...read more
Given a pattern and a list of words, determine if the words align with the pattern.
Iterate through the pattern and words simultaneously to check for alignment.
Use a hashmap to store the mapping between characters in the pattern and words.
Return 'True' if the words match the pattern sequence, else return 'False'.
The low-level design of an e-commerce website involves detailing the architecture, components, and interactions of the system.
Define the architecture including front-end, back-end, and database components
Detail the interactions between components such as user authentication, product search, and payment processing
Consider scalability, security, and performance optimizations in the design
Include features like user profiles, shopping cart functionality, and order management
Utili...read more
Top Software Developer Intern Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month