Josh Technology Group
100+ Rabatex Industries Interview Questions and Answers
You have been given an integer array/list 'ARR' of size 'N'. Write a solution to check if it could become non-decreasing by modifying at most 1 element.
We define an array as non-decreasing,...read more
The solution checks if an integer array can become non-decreasing by modifying at most one element.
Iterate through the array and check if there are more than one decreasing pairs of elements.
If there are more than one decreasing pairs, return false.
If there is only one decreasing pair, check if modifying one of the elements can make the array non-decreasing.
If modifying the element at index i-1 or i can make the array non-decreasing, return true.
Otherwise, return false.
You have been given an integer array/list(ARR) of size N. Where N is equal to [2M + 1].
Now, in the given array/list, 'M' numbers are present twice and one number is present only once.
You need to fi...read more
The task is to find the unique number in an array where all other numbers occur twice.
The array size is given by N = 2M + 1, where M is the number of elements occurring twice.
Loop through the array and use a hashmap to count the occurrences of each number.
Return the number with a count of 1, as it is the unique number.
You are given ‘N’ binary tree nodes numbered from 0 to N - 1 where node ‘i’ has two children LEFT_CHILD[i] and RIGHT_CODE[i]. Return ‘True’ if and only if all the given nodes form exac...read more
The task is to determine if the given binary tree nodes form exactly one valid binary tree.
Check if there is only one root node (a node with no parent)
Check if each node has at most one parent
Check if there are no cycles in the tree
Check if all nodes are connected and form a single tree
You are given an integer 'H'. Your task is to count and print the maximum number of balanced binary trees possible with height 'H'.
The balanced binary tree is one in which, for every node, ...read more
The maximum number of balanced binary trees possible with a given height is to be counted and printed.
A balanced binary tree is one in which the difference between the left and right subtree heights is less than or equal to 1.
The number of balanced binary trees can be calculated using dynamic programming.
The number of balanced binary trees with height 'H' can be obtained by summing the product of the number of balanced binary trees for each possible left and right subtree hei...read more
You are given a Singly Linked List of integers which is sorted based on absolute value.
You have to sort the Linked List based on actual values.
The absolute value of a real number x, denoted |...read more
The task is to sort a singly linked list based on actual values instead of absolute values.
Traverse the linked list and store the values in an array
Sort the array using any sorting algorithm
Create a new linked list using the sorted array
Return the new linked list
You are given a Singly Linked List of integers. You have to find if the given linked list is palindrome or not.
A List is a palindrome if it reads the same from the left to the...read more
You have been given an unsorted array ‘ARR’.
Your task is to sort the array in such a way that the array looks like a wave array.
Example:
If the given sequence ‘ARR’ has ‘N’ elements ...read more
The task is to sort an array in a wave form, where each element is greater than or equal to its adjacent elements.
Iterate through the array and swap adjacent elements if they do not follow the wave pattern
Start from the second element and compare it with the previous element, swap if necessary
Continue this process until the end of the array
Repeat the process for the remaining elements
Return the sorted wave array
You are given a Binary Search Tree (BST) and a target value ‘K’. Your task is to check if there exist two unique elements in the given BST such that their sum is equal to the given target ‘K’.
A...read more
The task is to check if there exist two unique elements in the given BST such that their sum is equal to the given target 'K'.
Traverse the BST in-order and store the elements in a sorted array
Use two pointers, one at the beginning and one at the end of the array
Check if the sum of the elements at the two pointers is equal to the target 'K'
If the sum is less than 'K', move the left pointer to the right
If the sum is greater than 'K', move the right pointer to the left
Repeat the...read more
You are given a Binary Tree ‘root’. The given Binary Tree may or may not be a Binary Search Tree(BST) itself. Your task is to find the maximum sum of node values of any subtree that is a Binary S...read more
The task is to find the maximum sum of node values of any subtree that is a Binary Search Tree(BST).
Traverse the binary tree in a bottom-up manner
For each node, check if it forms a BST and calculate the sum of its subtree
Keep track of the maximum sum encountered so far
Return the maximum sum
You are given an unsorted array containing ‘N’ integers. You need to find ‘K’ largest elements from the given array. Also, you need to return the elements in non-decreasing order.
Input Format...read more
You are given a Binary Tree. You are supposed to return the length of the diameter of the tree.
The diameter of a binary tree is the length of the longest path between any two end nodes i...read more
The diameter of a binary tree is the length of the longest path between any two end nodes in the tree.
The diameter of a binary tree can be calculated by finding the maximum of the following three values: 1) the diameter of the left subtree, 2) the diameter of the right subtree, and 3) the longest path that passes through the root node.
To find the diameter of a binary tree, we can use a recursive approach. We calculate the height of the left and right subtrees, and then calcul...read more
You are given an array 'ARR' of Integers having 'N' elements. The array contains an encoded message. For each index 'i', 'ARR[i]' denotes the frequency of the 'i'th' character in the message. The ...read more
You have been given ‘K’ different arrays/lists, which are sorted individually (in ascending order). You need to merge all the given arrays/list such that the output array/list should be sor...read more
Ninja is playing with numbers but hates when he gets duplicate numbers. Ninja is provided an array, and he wants to remove all duplicate elements and return the array, but he has to maintain th...read more
You are given an array(PRICES) of stock prices for N consecutive days. Your task is to find the maximum profit that you can make by completing as many transactions as you like, where a ...read more
You are given a railway seat number as an integer, your task is to check whether it is a valid seat number or not. Also print its berth type i.e lower berth, middle berth, upper bert...read more
Get the frogs and the lilypads line up in order (e.g. yellow lilypad is the first among all other lilypads and yellow frog is first among all other frogs) using flex-direction.
Arrange the fr...read more
You are given an arbitrary binary tree, a node of the tree, and an integer 'K'. You need to find all such nodes which have a distance K from the given node and return ...read more
The task is to find all nodes in a binary tree that are at a distance K from a given node.
Implement a function that takes the binary tree, target node, and distance K as input.
Use a depth-first search (DFS) algorithm to traverse the tree and find the nodes at distance K.
Keep track of the distance from the current node to the target node while traversing.
When the distance equals K, add the current node to the result list.
Continue the DFS traversal to explore other nodes in the...read more
There is a wedding ceremony at NinjaLand. The bride and groom want everybody to play a game and thus, they have blindfolded the attendees. The people from the bride’s side are holding odd numb...read more
You are given ‘N’ pairs of integers in which the first number is always smaller than the second number i.e in pair (a,b) -> a < b always. Now we define a pair chain as the continuous ...read more
You are given an infinite supply of coins of each of denominations D = {D0, D1, D2, D3, ...... Dn-1}. You need to figure out the total number of ways W, in which you can make a change fo...read more
Nobita wants to impress Shizuka by guessing her lucky number.
Shizuka gave Nobita a sorted list of ‘N’ numbers such that every number occurred twice in the list except Shizuka’s lu...read more
A thief is robbing a store and can carry a maximal weight of W into his knapsack. There are N items and the ith item weighs wi and is of value vi. Considering the constraints of the maximum weight t...read more
You have been given an array/list 'ARR' consisting of 'N' integers. Your task is to find the majority element in the array. If there is no majority element present, print -1.
Note:
A majority el...read more
You are given a string ('STR') of length 'N'. Find the longest palindromic substring. If there is more than one palindromic substring with the maximum length, return the one with th...read more
You are given an array ‘ARR’ of integers. Your task is to find the length of the longest alternating subsequence.
Note:
A sequence a1, a2, .... an is called an alternating sequenc...read more
You are Harshad Mehta’s friend. He told you the price of a particular stock for the next ‘N’ days. You can either buy or sell a stock. Also, you can only complete at most 2-transactions. Find ...read more
Given two numbers represented by linked lists. Your task is to find the multiplied list and return the head of the multiplied list.
The multiplied list is a linked list representation of th...read more
You have been given two Strings “STR1” and “STR2” of characters. Your task is to find the length of the longest common subsequence.
A String ‘a’ is a subsequence of a String ‘b’ if ‘a’...read more
Given two numbers represented by linked lists. Your task is find the sum list and return the head of the sum list.
The sum list is a linked list representation of addition of two numbers.
Input ...read more
We have a collection of 'N' stones, each stone has a positive integer weight.
On each turn, we choose the two heaviest stones and smash them together. Suppose the stones have weights 'x' and 'y...read more
This question is about finding the weight of the last stone after repeatedly smashing the two heaviest stones together.
Sort the array of stone weights in descending order.
Repeatedly smash the two heaviest stones until there is at most 1 stone left.
If there is 1 stone left, return its weight. Otherwise, return 0.
You are given a binary tree with 'N' nodes. Your task is to return the size of the largest subtree of the binary tree which is also a BST.
A binary search tree (BST) is a binar...read more
You are given a webpage design and you have to code the same using html, CSS, core Js
Coding a webpage design using html, CSS, and core Js
Start by creating the basic structure of the webpage using HTML
Use CSS to style the elements according to the design
Implement any interactive features using core JavaScript
Ensure responsiveness for different screen sizes
Optimize code for performance and accessibility
Ninja is stuck in a maze which is in a form of a binary tree. He needs your help in order to get out.
Ninja is presently at the node ‘X’. The only exit points of the maz...read more
Bob lives with his wife in a city named Berland. Bob is a good husband, so he goes out with his wife every Friday to ‘Arcade’ mall.
‘Arcade’ is a very famous mall in Berland. It has a very unique t...read more
You are given ‘N’ 2-D matrices and an array/list “ARR” of length ‘N + 1’ where the first ‘N’ integers denote the number of rows in the Matrices and the last element denotes the number...read more
You are given an arbitrary binary tree consisting of 'N' nodes where each node is associated with a certain value. You need to find out the height of the tree.
Height of a binary tree is th...read more
For a given two-dimensional integer array/list of size (N x M), print it in a spiral form. That is, you need to print in the order followed for every iteration:
a. First row(left to right) b. Last c...read more
First, he asked me about different meta tags in HTML and different types of CSS media queries.
Then he asked me questions about Promise and async-await. I need to create a function that takes ...read more
You are given an array/list of ‘N’ integers. You are supposed to return the maximum sum of the subsequence with the constraint that no two elements are adjacent in the given ...read more
You are given a binary tree consisting of integer values. Your task is to convert the given binary tree into a linked list where the nodes of the linked list follow the same or...read more
Ninja bought chocolate consisting of some chunks. The sweetness of each chunk is given in an array ‘ARR’. Ninja has ‘K’ friends, and he wishes to divide the chocolate into 'K' + 1 cut with some...read more
I was told to build a compound interest calculator where we need to store the previous calculation, ability to modify/delete them. There were 2 bonus features like store data in local storage ...read more
You are given a 2-dimensional array/list having N rows and M columns, which is filled with ones(1) and zeroes(0). 1 signifies land, and 0 signifies water.
A cell is said to be connected to...read more
We are suffering from the Second wave of Covid-19. The Government is trying to increase its vaccination drives. Ninja wants to help the Government to plan an effective method to help increase v...read more
You are given an arbitrary binary tree consisting of N nodes where each node is associated with a certain integer value from 1 to 9. Consider each root to leaf path as a number.
For example:
1 ...read more
Given a binary tree. You need to check if it is a height-balanced binary tree.
Height of a tree is the maximum number of nodes in a path from the node to the leaf node.
An empty tr...read more
You are given an integer 'N'. For a given 'N' x 'N' chessboard, find a way to place 'N' queens such that no queen can attack any other queen on the chessboard.
A queen can be killed when it lies in the ...read more
You are given a Binary Tree. You are supposed to return the length of the diameter of the tree.
The diameter of a binary tree is the length of the longest path between any two end no...read more
You are given a square matrix, return true if the matrix is symmetric otherwise return false.
A symmetric matrix is that matrix whose transpose is equal to the matrix itself.
Example of symm...read more
You have been given a singly Linked List in the form of 'L1' -> 'L2' -> 'L3' -> ... 'Ln'. Your task is to rearrange the nodes of this list to make it in the form of 'L1' -> 'Ln' -> 'L2' -> ...read more
You have been given an array/list 'SEQUENCE' denoting the sequence of 'N' integers. Your task is to find the equilibrium indices of the sequence in 'SEQUENCE'.
The equilibrium i...read more
Given a set of ‘N’ nuts of different sizes and ‘N’ bolts of different sizes. There is a one-one mapping between nuts and bolts. Your task is to find the correct match of nuts and bolts from the gi...read more
You are given two Singly Linked List of integers, which are merging at some node of a third linked list.
Your task is to find the data of the node at which merging starts. If there is...read more
You are given a paragraph that may have letters both in lowercase and uppercase, spaces, and punctuation. You have also given a list of banned words. Now your task is to find the most frequent...read more
You are given a linked list of 'N' nodes and an integer 'K'. You have to reverse the given linked list in groups of size K i.e if the list contains x nodes numbered from 1 to x, then yo...read more
You are given roots of two binary trees, ‘ROOT1’ and ‘ROOT2’. You need to merge the two trees into a new binary tree. The merge rule is that if the two nodes overlap, then the sum of the ...read more
You have been given an arbitrary binary tree and a node of this tree. You need to find the inorder successor of this node in the tree.
The inorder successor of a node in a binary tree is that no...read more
You are given an array of distinct elements, and you have to rearrange the array elements in a zig-zag fashion. In other words, for every odd position ‘i’ in the array 'ARR,' 'ARR'[i] should be g...read more
You are a student of Netaji Subhas Institute of Technology. You have to take ‘N’ number of courses labelled from 1 to N to complete your B.Tech Degree.
Some courses may have prerequisites, for ex...read more
You have been given a Linked List having ‘N’ nodes and an integer ‘K’. You have to rotate the Linked List by ‘K’ positions in a clockwise direction.
Example :
Given Linked List : 1 2 3 4 -1 a...read more
You are given a N x M matrix of integers, print the spiral path of the matrix.
For example:
Input Format:
The first line contains an integer 'T' which denotes the number of test cases or queries t...read more
Given a Binary Search Tree (BST) and a range [min, max], remove all keys which are outside the given range. The modified tree should also be BST.
Input format:
The first l...read more
Given a singly linked list of integers. Your task is to return the head of the reversed linked list.
For example:
The given linked list is 1 -> 2 -> 3 -> 4-> NULL. Then the reverse linked lis...read more
You are given an arbitrary binary tree consisting of N nodes numbered from 1 to N, an integer 'K', and a node 'TARGET_NODE_VAL' from the tree. You need to find the Kth ances...read more
Given a binary tree with 'N' number of nodes, convert it to a Greater Tree such that data of every node of the original BST is changed to the original node’s data plus the sum o...read more
Given a matrix, clockwise rotate elements in it K times. Rotating the matrix by 90 degrees clockwise will be counted as 1.
See the sample input.
Input format :
Line 1 : Number of rows M and...read more
Create a Stopwatch using HTML, CSS, and JS
Create an input form using HTML, CSS, and JS
Create some basic structure using HTML, CSS, and JS. I can't remember it but it was also some ...read more
You have been given an undirected graph of ‘V’ vertices (labelled from 0 to V-1) and ‘E’ edges. Each edge connecting two nodes u and v has a weight denoting the distance between them.
Yo...read more
You have been given a Binary Tree of integers. You are supposed to return the level order traversal of the given tree.
For example:
For the given binary tree
The level o...read more
Given an integer ‘N’ representing the number of pairs of parentheses, Find all the possible combinations of balanced parentheses with the given number of pairs of parentheses.
Note :
Conditi...read more
You have been given an undirected graph of ‘V’ vertices (labeled 0,1,..., V-1) and ‘E’ edges. Each edge connecting two nodes (‘X’,’Y’) will have a weight denoting the distance between no...read more
We were given a Figma link for a landing page of a website. We need to pixel-perfect that design.
Why you used object for storing the todo list rather than using an array?
Difference between inline, inline-block and block elements?
What is CDN?
What is the difference between localstorage, se...read more
Object provides key-value pairs for todo items, allowing for easier access and manipulation.
Objects allow for more structured data storage compared to arrays
Objects provide key-value pairs for easy access to todo items
Objects can store additional information about each todo item
What are higher order functions?
Higher order functions are functions that can take other functions as arguments or return functions as their results.
Higher order functions can be used to create more flexible and reusable code.
They enable functional programming paradigms.
Examples of higher order functions include map, filter, and reduce in JavaScript.
Design and develop and todo list type of application using localstorage.
A todo list application using localstorage.
Use HTML, CSS, and JavaScript to create the user interface.
Use the localstorage API to store and retrieve todo items.
Implement features like adding, editing, and deleting todo items.
Display the list of todo items and their status.
Allow users to mark todo items as completed or incomplete.
What is hoisting in javascript?
Hoisting is a JavaScript behavior where variable and function declarations are moved to the top of their containing scope.
Hoisting applies to both variable and function declarations.
Variable declarations are hoisted but not their initializations.
Function declarations are fully hoisted, including their definitions.
Hoisting can lead to unexpected behavior if not understood properly.
What are promises in javascript?
Promises in JavaScript are objects that represent the eventual completion or failure of an asynchronous operation.
Promises are used to handle asynchronous operations such as fetching data from a server or reading a file.
They simplify the process of writing asynchronous code by providing a more structured approach.
Promises have three states: pending, fulfilled, or rejected.
They can be chained together using methods like .then() and .catch().
Promises help avoid callback hell an...read more
Design a given signin page using HTML and CSS only.
Design a signin page using HTML and CSS only
Create a form element with input fields for username and password
Style the form using CSS to make it visually appealing
Add a submit button for users to sign in
Consider adding error messages or validation for user input
Use CSS to make the page responsive for different screen sizes
Questions were related to OOPS, Data Structures, Databases.
Number Of MCQs - 60
What is memoization in js?
Memoization is a technique in JavaScript to cache the results of expensive function calls for future use.
Memoization improves performance by avoiding redundant calculations
It is commonly used in recursive functions or functions with expensive computations
The cached results are stored in a data structure like an object or a map
Memoization can be implemented manually or using libraries like Lodash or Memoizee
What is Temporal Dead Zone?
Temporal Dead Zone is a behavior in JavaScript where variables are not accessible before they are declared.
Temporal Dead Zone occurs when accessing variables before they are declared
Variables in the Temporal Dead Zone cannot be accessed or assigned
The Temporal Dead Zone is a result of JavaScript's hoisting behavior
Example: accessing a variable before it is declared will throw a ReferenceError
Basic questions from Javatpoint.
A recent project that you worked on.
What are arrow functions?
Arrow functions are a concise way to write functions in JavaScript.
Arrow functions have a shorter syntax compared to regular functions.
They do not have their own 'this' value.
They do not have the 'arguments' object.
They cannot be used as constructors with the 'new' keyword.
They are commonly used in functional programming and with array methods like 'map' and 'filter'.
Q85. What is software development life cycle and which steps are following?
Software development life cycle (SDLC) is a process used by software developers to design, develop, and test software.
1. Planning: Define the project scope, requirements, and objectives.
2. Analysis: Gather and analyze user requirements.
3. Design: Create a detailed design of the software.
4. Implementation: Develop the software based on the design.
5. Testing: Test the software for bugs and issues.
6. Deployment: Release the software to users.
7. Maintenance: Update and maintain t...read more
Design a Web Crawler.
What is virtual DOM?
Virtual DOM is a lightweight copy of the actual DOM that allows efficient updates and rendering in JavaScript frameworks.
Virtual DOM is a concept used in JavaScript frameworks like React.
It is a lightweight copy of the actual DOM tree.
Changes made to the virtual DOM are compared with the actual DOM to determine the minimal updates needed.
This helps in efficient rendering and improves performance.
Virtual DOM allows developers to write code as if the entire page is rendered on ...read more
Q88. Regression test cases for any application
Regression test cases ensure that changes to the application do not negatively impact existing functionality.
Identify critical functionalities and test cases that cover them
Test for compatibility with different browsers and devices
Test for data integrity and consistency
Test for performance and scalability
Test for security vulnerabilities
Test for user experience and accessibility
Q89. Given a value find next sibling on right side of it without using global/heap variables
Use a binary tree traversal algorithm to find the next sibling on the right side of a given value.
Implement an in-order traversal algorithm to traverse the binary tree
Keep track of the parent node and the direction of traversal to find the next sibling on the right side
If the given value is the right child of its parent, move up the tree until finding a node that is the left child of its parent
What is IIFE?
IIFE stands for Immediately Invoked Function Expression. It is a JavaScript function that is executed as soon as it is defined.
IIFE is a way to create a function expression and immediately invoke it.
It helps in creating a private scope for variables and functions.
It is commonly used to avoid polluting the global namespace.
IIFE can be written using different syntaxes like using parentheses, function declaration, or arrow functions.
What is JSX?
JSX is a syntax extension for JavaScript that allows you to write HTML-like code in your JavaScript files.
JSX stands for JavaScript XML
It is commonly used with React to define the structure and appearance of components
JSX elements are transpiled into regular JavaScript function calls
It allows you to write HTML-like code with JavaScript expressions embedded within curly braces
Example:
Hello, {name}!
Q92. What is api and how it is work ?
API stands for Application Programming Interface. It is a set of rules and protocols that allows different software applications to communicate with each other.
APIs define the methods and data formats that applications can use to request and exchange information.
APIs can be used to access services provided by other software applications, such as retrieving data from a database or sending notifications.
Examples of APIs include the Google Maps API, which allows developers to in...read more
Q94. Introduction test cases of various objects near you
Introduction test cases for objects near me
Test case for testing a chair: verify stability, check for any damages, test weight capacity
Test case for testing a computer: check if it powers on, test functionality of keyboard and mouse, verify internet connectivity
Test case for testing a pen: check if it writes smoothly, test ink flow, verify if cap fits securely
Q95. Check if binary tree is balanced or not.
Check if binary tree is balanced or not.
A balanced binary tree has the height of left and right subtrees differ by at most 1.
Recursively check the height of left and right subtrees and compare.
Use a helper function to calculate the height of a subtree.
Time complexity: O(nlogn) for a balanced tree, O(n^2) for a skewed tree.
Q96. Delete a node from a binary tree.
Delete a node from a binary tree.
Find the node to be deleted
If the node has no children, simply delete it
If the node has one child, replace it with its child
If the node has two children, find the minimum value in its right subtree, replace the node with that value, and delete the minimum value node
Q97. Detect a loop in linked list
Use Floyd's Tortoise and Hare algorithm to detect a loop in a linked list.
Initialize two pointers, slow and fast, at the head of the linked list.
Move slow pointer by one step and fast pointer by two steps.
If they meet at any point, there is a loop in the linked list.
Q98. Left view of tree
Left view of a tree is the set of nodes visible when the tree is viewed from the left side.
Traverse the tree in a level order manner
Keep track of the first node encountered at each level
Add the first node encountered at each level to the result array
Q99. Detect loops in linked list.
Detect loops in a linked list.
Use two pointers, one moving at a faster pace than the other.
If there is a loop, the faster pointer will eventually catch up to the slower one.
To detect the start of the loop, reset one pointer to the head and move both pointers at the same pace.
Q100. Ai tools importance in sqa
AI tools play a crucial role in Software Quality Assurance by automating testing processes, improving efficiency, and detecting defects early.
AI tools can automate repetitive testing tasks, saving time and effort.
AI tools can analyze large amounts of data quickly and accurately, helping to identify potential defects.
AI tools can improve test coverage by generating test cases based on historical data and patterns.
AI tools can help in predicting potential issues before they occ...read more
Top HR Questions asked in Rabatex Industries
Interview Process at Rabatex Industries
Top Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month