Sudhir sharma has Published 1149 Articles

XOR of all subarray XORs in C++

sudhir sharma

sudhir sharma

Updated on 20-Apr-2020 11:55:42

464 Views

In this problem, we are given an array of n elements. Our task is to print XOR of XORs all possible subarrays (taken in order) created from elements of the array.Let’s take an example to understand the problem, Input − array = {1, 3, 6, 8}Output − 0Explanation −(1) ^ ... Read More

XOR of all the elements in the given range [L, R] in C++

sudhir sharma

sudhir sharma

Updated on 20-Apr-2020 11:54:06

656 Views

In this problem, we are given two integer L and R denoting a range. Our task is to find xor of all elements within the range [L, R].Let’s take an example to understand the problem, Input − L=3, R = 6Explanation − 3^4^5^6 =To solve this problem, we will find ... Read More

XOR of all the nodes in the sub-tree of the given node in C++

sudhir sharma

sudhir sharma

Updated on 20-Apr-2020 11:50:50

301 Views

In this problem, we are given an n tree and there are some queries that are nodes of the tree. Our task is to print the XOR of all nodes of the sub-tree formed by the given node.Let’s take an example to understand the problem, Queries − {1, 6, 5}Output ... Read More

XOR of numbers that appeared even number of times in given Range in C++

sudhir sharma

sudhir sharma

Updated on 20-Apr-2020 11:48:19

158 Views

In this problem, we are given an array of n elements and there are some queries which are range from a start point to endpoint in the array. Our task is two finds the XOR of elements that appeared even a number of times in the range.Let’s take an example ... Read More

XOR of the path between any two nodes in a Binary Tree in C++

sudhir sharma

sudhir sharma

Updated on 20-Apr-2020 11:45:21

317 Views

In this problem, we are given a binary tree and two nodes of the binary tree. Our task is to print the XOR of all nodes that come in the path between the two nodes.Let’s take an example to understand the problem, We need to find the xor of all ... Read More

XOR of Prime Frequencies of Characters in a String in C++

sudhir sharma

sudhir sharma

Updated on 20-Apr-2020 11:41:56

194 Views

In this problem, we are given a string of characters, our task is to print the XOR of frequencies of characters of the string whose frequency of occurrence is a prime number.Let’s take an example to understand the problem, Input − TutorialsPointOutput −Here, we will check the frequency of occurrence ... Read More

XOR of Sum of every possible pair of an array in C++

sudhir sharma

sudhir sharma

Updated on 20-Apr-2020 11:39:02

256 Views

In this problem, we are given an array of n elements. Our task is to generate a sequence of size n*n whose elements are the sum of a pair of all elements of A with itself. And print the xor elements of this sum array formed.Let’s take an example to ... Read More

Write a function to get Nth node in a Linked List in C++

sudhir sharma

sudhir sharma

Updated on 20-Apr-2020 11:27:28

710 Views

Here, we are given a linked list and an index. We have to write a function to get Nth node in a linked list.Let’s take an example to understand the problem, Inputlinked list = 34 -> 4 -> 9 -> 1 , n = 2Output9To go to the node specified ... Read More

Write a program that produces different results in C and C++ programming

sudhir sharma

sudhir sharma

Updated on 20-Apr-2020 11:24:53

164 Views

Write a program that compiler and runs both in c and c++ and produces different results.There are multiple types of programs that give different results when compiled in c and c++.i. Using character literals− c and c++ both treat characters differently. In C, they are treated as integer literals whereas, ... Read More

Write a program to reverse an array or string in C++

sudhir sharma

sudhir sharma

Updated on 20-Apr-2020 11:15:49

1K+ Views

Here, we are given an array or a string of characters. We will create a program to reverse the elements of an array or string.Let’s take an example to understand the problem, Inputarray = {2, 5, 7, 1, 9}Output{9, 1, 7, 5, 2}Inputstring = “Hello!”Output!0lleHTo create a program, we will ... Read More

Advertisements