Server Side Programming Articles - Page 1854 of 2646

is_pod template in C++

Sunidhi Bansal
Updated on 23-Mar-2020 05:35:46

195 Views

In this article we will be discussing the working, syntax and examples of std::is_pod template in C++ STL.is_ pod is a template which comes under header file. This template is used to check whether the given type T is a POD(plain-old-data) type or not.What is POD(Plain old data)?Plain old data(POD) types are those types which are also in old C language. POD types also include scalar types. POD class type is that class type which is both, trivial (which can be initialised statically) and standard layout (which is a simple data structure like struct and union).Syntaxtemplate is_pod;ParametersThe template ... Read More

is_fundamental Template in C++

Sunidhi Bansal
Updated on 23-Mar-2020 05:29:40

238 Views

In this article we will be discussing the working, syntax and examples of std::is_fundamental template in C++ STL.is_ fundamental is a template which comes under the header file. This template is used to check whether the given type T is a fundamental data type or not.What is Fundamental type?Fundamental types are the built-in types which are already declared in the compiler itself. Like int, float, char, double, etc. These are also known as built-in data types.All the data types which are user-defined like: class, enum, struct, references or pointers, are not part of the fundamental type.Syntaxtemplate is_fundamental;ParametersThe template ... Read More

is_final template in C++

Sunidhi Bansal
Updated on 23-Mar-2020 05:08:08

218 Views

In this article we will be discussing the working, syntax and examples of std::is_final template in C++ STL.is_final is a template which comes under the header file. This template is used to check whether the given type T is a final class or not.What is a final class in C++?When we declare a class with the final specifier then it is called as Final Class. Final class is a special kind of class which can’t be extended to create another class. In C++ to make a class as a final we make a class as a friend and then ... Read More

Executing C# code in Linux

Ajay yadav
Updated on 05-Jan-2021 06:38:26

5K+ Views

The .NET centric applications are meant to windows operating system up till now, but now Microsoft has introduced a new cross-platform application called Mono which enables the execution of the application developed under the .NET platform in Linux environment by giving an impression in such a way that as if we are running Linux package rather than executing .exe file.MonoMono is an open-source utility that allows the developer to execute .NET centric applications on other platforms such as Mac or Linux as it provides an installation package for Windows platform to compile and execute .NET assemblies on Windows OS without ever ... Read More

Minimum Flips to Make a OR b Equal to c in C++

Arnab Chakraborty
Updated on 30-Apr-2020 11:59:36

696 Views

Suppose we have 3 positives numbers a, b and c. We have to find the minimum flips required in some bits of a and b to make (a OR b == c ). Here we are considering bitwise OR operation.The flip operation consists of change any single bit 1 to 0 or change the bit 0 to 1 in their binary representation. So if a : 0010 and b := 0110, so c is 0101, After flips, a will be 0001, and b will be 0100To solve this, we will follow these steps −ans := 0for i in range 0 ... Read More

Sum of Nodes with Even-Valued Grandparent in C++

Arnab Chakraborty
Updated on 30-Apr-2020 11:51:56

212 Views

Suppose we have a binary tree, we have to find the sum of values of nodes with even-valued grandparent. (A grandparent of a node is the parent of its parent, if it exists.). If there are no such nodes with an even-valued grandparent, then return 0. So if the tree is like −The output will be 18. The red nodes are nodes with even-value grandparent, while the blue nodes are the even valued grandparents.To solve this, we will follow these steps −Define a map called parentDefine a method called solve(), this will take node and parif node is null, then ... Read More

Matrix Block Sum in C++

Arnab Chakraborty
Updated on 30-Apr-2020 11:33:32

491 Views

Suppose we have one m * n matrix called mat and an integer K, we have to find another matrix answer where each answer[i][j] is the sum of all elements mat[r][c] for i - K

XOR Queries of a Subarray in C++

Arnab Chakraborty
Updated on 30-Apr-2020 11:30:17

289 Views

Suppose we have the array arr of positive integers and the array queries where queries[i] = [Li, Ri], for each query the i compute the XOR of elements from Li to Ri (that is, arr[Li] XOR arr[Li+1] xor ... xor arr[Ri] ). We have to find the array containing the result for the given queries. So if the input is like − [1, 3, 4, 8], and queries are like [[0, 1], [1, 2], [0, 3], [3, 3]], then the result will be [2, 7, 14, 8]. This is because the binary representation of the elements in the array are ... Read More

Jump Game III in C++

Arnab Chakraborty
Updated on 30-Apr-2020 11:26:25

470 Views

Suppose we have an array of non-negative integers arr, we are initially positioned at start index of the array. When we are present at index i, we can jump to i + arr[i] or i - arr[i], check if we can reach to any index with value 0. We have to keep in mind that we cannot jump outside of the array at any time. So if the input is like: arr = [4, 2, 3, 0, 3, 1, 2] and start from 5, then output will be true, as move 5 → 4 → 1 → 3, or 5 ... Read More

All Elements in Two Binary Search Trees in C++

Arnab Chakraborty
Updated on 30-Apr-2020 11:22:51

292 Views

Suppose we have two binary search trees, we have to return a list of values, that has all elements present in these trees, and the list elements will be in ascending order. So if the trees are like −Then the output will be [0, 1, 1, 2, 3, 4].To solve this, we will follow these steps −Define an array called ans, define two stacks st1 and st2curr1 := root1 and curr2 := root2insert node root1 and all left nodes into st1, insert node root2 and all left nodes into st2while st1 is not empty or st2 is not emptyif st1 ... Read More

Advertisements