Prateek Jangid has Published 190 Articles

C++ Remove an Entry Using Value from HashMap while Iterating over It

Prateek Jangid

Prateek Jangid

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

473 Views

Discuss how to remove an entry from HashMap using the value while iterating over it, for exampleInput: HashMap: { 1: “ Mango ”, 2: “ Orange ”, 3: “ Banana ”, 4: “Apple ” }, value=”Banana” Output: HashMap: { 1: “ Mango ”, 2: “ Orange ”, 4: “Apple ... Read More

C++ Rearrange a string in sorted order followed by the integer sum

Prateek Jangid

Prateek Jangid

Updated on 26-Nov-2021 06:07:01

694 Views

Discuss a problem to rearrange a string of alphabets in sorted order and add all the integers present in the string, for exampleInput : str = “adv4fc3” Output : “ acdfv7” Explanation: all the letters have been sorted to “acdfv” followed by the sum of integers 4 and 3. ... Read More

C++ Ratio of Mth and Nth Terms of an A. P. with Given Ratio of Sums

Prateek Jangid

Prateek Jangid

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

92 Views

Discuss a problem where we are given a ratio of sums of m and n terms of A.P. We need to find the ratio of mth and nth terms.Input: m = 8, n = 4 Output: 2.142 Input: m = 3, n = 2 Output: 1.666 Input: m ... Read More

Python - Ranking Rows of Pandas DataFrame

Prateek Jangid

Prateek Jangid

Updated on 26-Nov-2021 06:03:47

873 Views

To add a column that contains the ranking of each row in the provided data frame that will help us to sort a data frame and determine the rank of a particular element, for example −Our DataframeName Play Time (in hours)Rate0Call Of Duty45Better than Average1Total Overdose46Good2GTA352Best3Bully22AverageOutputName Play Time (in hours)Rate ... Read More

C++ Range Sum Queries and Update with Square Root

Prateek Jangid

Prateek Jangid

Updated on 26-Nov-2021 06:01:53

227 Views

Given an array and several queries. Also, there are two types of query, i.e., update[ L, R ] means update elements from L to R with their square roots, and query[ L, R ] means to calculate the sum of elements from L to R.We are assuming a 1-based indexed ... Read More

C++ Rat in a Maze with Multiple Steps or Jump Allowed

Prateek Jangid

Prateek Jangid

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

217 Views

Given a n*n grid maze. Our rat is present in the top left corner of the grid. Now rats can only move down or forward, and if and only if the block has a non-zero value to it now in this variation rat is allowed to have multiple jumps. The ... Read More

C++ Range Sum Query Using Sparse Table

Prateek Jangid

Prateek Jangid

Updated on 26-Nov-2021 05:59:26

195 Views

Sparsh Table is a data structure, which is used to give results of range queries. It provides the result of most range queries in O(logN) complexity. For maximum range queries, it can also compute the result in O(1).This tutorial will discuss the problem of a range sum query using a ... Read More

C++ Queries to Answer the Number of Ones and Zeros to the Left of Given Index

Prateek Jangid

Prateek Jangid

Updated on 26-Nov-2021 05:50:59

148 Views

Discuss a problem to answer queries to the given array. For each query index, we need to find the number of ones and zeros to the left of the index, for example.Input: arr[ ] = { 0, 1, 1, 1, 0, 0, 0, 1, 0, 0}, queries[ ] = { ... Read More

C++ Queries on XOR of XORs of All Subarrays

Prateek Jangid

Prateek Jangid

Updated on 26-Nov-2021 05:48:39

153 Views

To calculate the XOR of all the subarrays present in the given range and print it. For exampleInput : arr[] = { 4, 1, 2, 3, 5 }, Q = 3 Queries q1 = { 1, 2 } q2 = { 2, 4 } q3 = { 1, ... Read More

C++ Queries on XOR of Greatest Odd Divisor of the Range

Prateek Jangid

Prateek Jangid

Updated on 26-Nov-2021 05:41:33

99 Views

Given an array of N integers and Q queries of ranges. For each query, we need to return the XOR of the greatest odd divisor of each number in the range.The greatest odd divisor is the greatest odd number which can divide number N, e.g . The greatest odd divisor ... Read More

Advertisements