Prateek Jangid has Published 190 Articles

Represent a Given Set of Points by the Best Possible Straight Line in C++

Prateek Jangid

Prateek Jangid

Updated on 26-Nov-2021 06:40:23

333 Views

Discuss How to represent a set of points by the best possible straight line. We are given values (x, y) of a set of points, and we need to find the best straight line y = mx + c, So all we need is to find the value of m ... Read More

Find the number with set bits only between L-th and R-th index using C++

Prateek Jangid

Prateek Jangid

Updated on 26-Nov-2021 06:39:11

93 Views

In the given problem we need to find the value of a number which has all of the set bits between the given range L, R. For example −Input: L = 1, R = 5 Output: 62 Explanation: representation of given L and R in binary form is 0..0111110 ... Read More

Function for Removing Forbidden Characters in C++

Prateek Jangid

Prateek Jangid

Updated on 26-Nov-2021 06:32:58

210 Views

Discuss the way to remove functions that will remove forbidden characters like [ ‘ : ’, ‘ ? ‘, ‘ \ ’, ‘ / ’, ‘ < ’, ‘ > ’, ‘ | ’, ‘ * ’ ] from a string, for exampleInput: str = “ Hello: Welco*me/ to Tu>torials ... Read More

Find the Number With Even Sum of Digits using C++

Prateek Jangid

Prateek Jangid

Updated on 26-Nov-2021 06:32:41

258 Views

An integer number that can be completely divided by 2 is an even number. So in this article we are given the number n, and we need to find the nth number with an even sum of digits. The First five numbers with an even sum of digits are 2, ... Read More

Remove One Bit from a Binary Number to Get Maximum Value in C++

Prateek Jangid

Prateek Jangid

Updated on 26-Nov-2021 06:30:28

370 Views

Discuss a problem in which we are given a binary number. We have to remove a bit from it so that the remaining number should be the maximum of all the other options, for exampleInput : N = 1011 Output: 111 Explanation: We need to remove one bit so removing ... Read More

C++ Remove an Entry Using Key from HashMap while Iterating Over It

Prateek Jangid

Prateek Jangid

Updated on 26-Nov-2021 06:27:21

712 Views

This tutorial will discuss how to remove an entry from HashMap using the key while traversing through it. for example, Input: HashMap: { 1: “Tutorials”,                   2: “Tutorials”,                   3: “Point” }, key=1 ... Read More

C++ Remove Nodes on Root to Leaf Paths of Length < K

Prateek Jangid

Prateek Jangid

Updated on 26-Nov-2021 06:27:10

110 Views

Given a tree, and we need to remove the leaf node of the path having a length less than the given k, for example.Input −K = 4.Output −ExplanationThe paths were : 1. A -> B -> C -> E length = 4 2. A -> B -> C -> F ... Read More

C++ Remove Invalid Parentheses from an Expression

Prateek Jangid

Prateek Jangid

Updated on 26-Nov-2021 06:23:33

157 Views

Given a parentheses sequence; now, you have to print all the possible parentheses that it can make by removing the invalid brackets, for exampleInput : str = “()())()” - Output : ()()() (())() There are two possible solutions "()()()" and "(())()" Input : str = (v)())() Output : (v)()() ... Read More

Find the Number of Ways to go From One Point to Another in a Grid using C++

Prateek Jangid

Prateek Jangid

Updated on 26-Nov-2021 06:23:16

178 Views

In this article, we are given a question in which we need to find the total number of ways from point A to B where A and B are fixed points, i.e., A is the top-left point in the grid and B is the bottom right point in the grid ... Read More

Find the Number of Unique Triplets Whose XOR is Zero using C++

Prateek Jangid

Prateek Jangid

Updated on 26-Nov-2021 06:16:23

382 Views

In this article, we will discuss counting the number of unique triplets (x, y, z) in a given array of unique numbers where their XOR is 0. Thus, triplets should be unique where all the three elements are unique and would count all the combinations of triplets for example −Input ... Read More

Advertisements