1. Given a linked list, how do you ensure that it is in decreasing order?
2. Given the head of a linked list, determine if the linked list has a cycle in it. There is a cycle in a linked list if there is some node in the list that can be reached again by continuously following the next pointer. Return true if there is a cycle in the linked list. Otherwise, return false.
3. Last Stone Weight Problem Explanation Given a collection of stones, each having a positive integer weight, perform the following operation: On each turn, select the two heaviest stones and smash them together. Assume the stones have weights 'x' and 'y' where 'x' <= 'y'. The outcomes of smashes are: If 'x' == 'y', both stones are destroyed. If 'x' != 'y', the stone with weight 'x' is destroyed, and the stone with weight 'y' is updated to 'y - x'. Continue this process until at most one stone remains. Return the weight of the last stone, or 0 if no stones are left. Input: First line: Integer 'N', the number of stones.Second line: 'N' space-separated integers representing the weights of the stones. Output: Print the weight of the final stone, or 0 if no stones remain. Example: Input: N = 6 Weights = [2, 7, 4, 1, 8, 1]Output: 1 Constraints: 1 <= N <= 10^5 1 <= W[i] <= 10^6 Time Limit: 1 sec Note: Implement the function to solve the problem. No need for explicit printing or input reading as it's handled internally.
4. Implement a live coding round to build a small CRUD-based application.
5. Inorder Successor in a Binary Tree Given an arbitrary binary tree and a specific node within that tree, determine the inorder successor of this node. Explanation: The inorder successor of a node in a binary tree is the node that is visited immediately after the given node during an inorder traversal of the tree. If the node is the last to be visited in the traversal, then its inorder successor is NULL. In an inorder traversal, the left subtree is visited first, followed by the node itself, and then the right subtree. Input: The first line contains a single integer 'T' representing the number of test cases. Each test case includes:1. Values of the nodes of the tree in level order format (with -1 indicating a NULL node).2. Value of the node for which the inorder successor is to be determined. Output: For each test case, print the value of the inorder successor node, or 'NULL' if no successor exists. Print each result on a new line. Example: Input: 21 2 3 4 -1 5 6 -1 7 -1 -1 -1 -1 -1 -131 2 3 4 -1 -1 -1 -1 -14 Output: 5NULL Constraints: 1 <= 'T' <= 100 2 <= 'N' <= 10^3 1 <= 'NODEVALUE' <= 10^9 Where 'N' is the total number of nodes and 'NODEVALUE' represents the value of the node. Note: You do not need to print anything; just implement the function as required. The problem ensures the node has a unique integer value and is part of the tree.
My Connections Josh Technology Group
Browse through a variety of job opportunities tailored to your skills and preferences. Filter by location, experience, salary, and more to find your perfect fit.