Paxcom India
NxtWave Interview Questions and Answers
Q1. Maximize Expression Value
Given an arithmetic expression EXP
containing integer values separated by any of the operators ‘+’, ‘-’, and ‘*’, your task is to place parentheses such that the value of the expressio...read more
Given an arithmetic expression, place parentheses to maximize the value of the expression.
Identify the operators in the expression ('+', '-', '*').
Consider the precedence of operators to determine where to place parentheses.
Calculate the value of the expression with different placements of parentheses to find the maximum value.
Q2. Kth Largest Element Problem Statement
Ninja enjoys working with numbers, and Alice challenges him to find the Kth largest value from a given list of numbers.
Input:
The first line contains an integer 'T', repre...read more
The task is to find the Kth largest element from a given list of numbers for each test case.
Read the number of test cases 'T'
For each test case, read the number of elements 'N' and the Kth largest number to find 'K'
Sort the array in descending order and output the Kth element
Q3. Kruskal’s Minimum Spanning Tree Algorithm Problem Statement
You are given a connected undirected weighted graph. Your task is to determine the weight of the minimum spanning tree of this graph.
A minimum spanni...read more
The task is to determine the weight of the minimum spanning tree of a given connected undirected weighted graph.
Implement Kruskal's algorithm to find the minimum spanning tree weight.
Sort the edges based on their weights in non-decreasing order.
Iterate through the sorted edges and add them to the MST if they don't form a cycle.
Keep track of the total weight of the MST and return it as the output.
Q4. Number Pattern Generation
Create a program to print a numeric pattern based on the given input integer N
which specifies the number of rows.
Example:
Input:
N = 4
Output:
1
23
345
4567
Explanation:
Each row starts...read more
Generate a numeric pattern based on the given input integer N specifying the number of rows.
Iterate from 1 to N to print each row
Start each row with the row index and increase consecutively per row count
Use nested loops to handle the increasing numbers in each row
Q5. Sum Tree Conversion
Convert a given binary tree into its sum tree. In a sum tree, every node's value is replaced with the sum of its immediate children's values. Leaf nodes are set to 0. Finally, return the pre...read more
Convert a binary tree into a sum tree by replacing each node's value with the sum of its children's values. Return the preorder traversal of the sum tree.
Traverse the tree in a bottom-up manner to calculate the sum of children for each node.
Set leaf nodes to 0 and update non-leaf nodes with the sum of their children.
Return the preorder traversal of the modified tree.
Q6. Determine the Left View of a Binary Tree
You are given a binary tree of integers. Your task is to determine the left view of the binary tree. The left view consists of nodes that are visible when the tree is vi...read more
To determine the left view of a binary tree, we need to find the nodes that are visible when the tree is viewed from the left side.
Traverse the binary tree in a level order manner and keep track of the first node at each level (leftmost node).
Store the leftmost nodes in an array as they are encountered during the traversal.
Return the array containing the left view of the binary tree.
Top Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month