# Cadence Interview Questions

See also
Directi Interview Questions

## Cadence India Array Questions

Question 1. Sqrt (or Square Root) Decomposition Technique You are given query of range an integer array. You will be asked to determine the sum of all the numbers that come in the range of given query. The query given is of two types, that are – Update: (index, value) is given as a query, where you need ...

Question 2. Sorting using trivial hash function The problem “Sorting using trivial hash function” states that you are given an integer array. An array can be containing both negative and positive numbers. The problem statement asks to sort the array using Trivial Hash Function. Example arr[] = {5,2,1,3,6} {1, 2, 3, 5, 6} arr[] = {-3, -1, ...

Question 3. Print all triplets in sorted array that form AP The problem “Print all triplets in sorted array that form AP” states that we have given a sorted integer array. The task is to find out all the possible triplets that can form an Arithmetic Progression. Example arr[] = {1,3,5,7,8,12,15,16,20,30} (1, 3, 5), (3, 5, 7), (1, 8, 15), (8, ...

Question 4. Find number of pairs in an array such that their XOR is 0 The problem “Find number of pairs in an array such that their XOR is 0” state that supposes, we have given an array of integers. The problem statement asks to find out the number of pairs present in an array, which has the pair Ai XOR Aj = 0. Note: ...

Question 5. Maximum possible difference of two subsets of an array Suppose, we have an integer array. The problem statement “Maximum possible difference of two subsets of an array” asks to find out the maximum possible difference between the two subsets of an array. Conditions to be followed: An array can contain repeating elements, but the highest frequency of an element ...

Question 6. Array Queries for multiply replacements and product The problem “Array Queries for multiply, replacements and product” states that you are given an array of integer and there will be three types of queries, where you have to solve the following type of queries: Type 1: There will be three values left, right and a number X.In this ...

Question 7. Mean of range in array Problem Statement The problem “Mean of range in array” states that you are given an integer array and q number of queries. Each query contains the left and right as a range. The problem statement asks to find out the floor mean value of all the integers that come in ...

Question 8. Maximize sum of consecutive differences in a circular array Problem Statement Suppose you have an integer array. This array should be treated as a circular array. The last value of an array will be connected to the first array, an ⇒ a1. The problem “Maximize sum of consecutive differences in a circular array” asks to find out the maximum ...

Question 9. Cumulative Frequency of Count of Each Element in an Unsorted Array We are given an unsorted array. The task is to calculate the cumulative frequency of count of each element in an unsorted array. Example Input: A[]={2,4,3,2,2,3,4} Output: Cumulative frequency of 2 in the array is: 3 Cumulative frequency of 3 in the array is: 5 Cumulative frequency of 4 in ...

## Cadence India String Questions

Question 10. Check if all Rows of a Matrix are Circular Rotations of Each Other Problem Statement In the “Check if all Rows of a Matrix are Circular Rotations of Each Other” problem we have given a char matrix, write a program to find whether all rows are circular rotations of each other or not. If all rows are circular rotations of each other print ...

## Cadence India Tree Questions

Question 11. Maximum Depth Of Binary Tree Problem Statement “Maximum depth of binary tree” problem states that you are given a binary tree data structure. Print the maximum depth of the given binary tree. Example Input 2 Explanation: Maximum depth for the given tree is 2. Because there is only a single element below the root (i.e. ...

## Cadence India Graph Questions

Question 12. Breadth First Search (BFS) for a Graph Breadth First Search (BFS) for a graph is a traversing or searching algorithm in tree/graph data structure. It starts at a given vertex(any arbitrary vertex) and explores all the connected vertex and after that moves to the nearest vertex and explores all the unexplored nodes and takes care that no ...

## Cadence India Queue Questions

Question 13. Breadth First Search (BFS) for a Graph Breadth First Search (BFS) for a graph is a traversing or searching algorithm in tree/graph data structure. It starts at a given vertex(any arbitrary vertex) and explores all the connected vertex and after that moves to the nearest vertex and explores all the unexplored nodes and takes care that no ...

## Cadence India Matrix Questions

Question 14. Check if all Rows of a Matrix are Circular Rotations of Each Other Problem Statement In the “Check if all Rows of a Matrix are Circular Rotations of Each Other” problem we have given a char matrix, write a program to find whether all rows are circular rotations of each other or not. If all rows are circular rotations of each other print ...

## Cadence India Other Questions

Question 15. Golomb sequence Problem Statement The problem “Golomb sequence” states that you are given an input integer n and you need to find all the elements of Golomb sequence until nth element. Example n = 8 1 2 2 3 3 4 4 4 Explanation The first 8 terms of the Golomb sequence ...

Question 16. Compute nCr % p Problem Statement The problem “Compute nCr % p” states that you are required to find binomial coefficient modulo p. So you first must know about the binomial coefficient. We have already discussed that in a previous post. You can check that here. Example n = 5, r = 2, p ...