Arnab Chakraborty has Published 4452 Articles

Number of Steps to Reduce a Number in Binary Representation to One in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 17-Nov-2020 11:42:40

137 Views

Suppose we have a number s in binary form. We have to find the number of steps to reduce it to 1 under these rules −If the current number is even, we have to divide it by 2.If the current number is odd, you have to add 1 to it.So, ... Read More

Circle and Rectangle Overlapping in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 17-Nov-2020 11:38:38

266 Views

Suppose we have a circle represented as (radius, xc, yc), here (xc, yc) is the center coordinate of the circle. We also have an axis-aligned rectangle represented as (x1, y1, x2, y2), where (x1, y1) are the coordinates of the bottom-left corner, and (x2, y2) are the coordinates of the ... Read More

Count Number of Teams in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 17-Nov-2020 11:36:52

267 Views

Suppose there are n soldiers standing in a line. Here each soldier is assigned a unique rating value. We have to make a team of 3 soldiers amongst them using the following rules −Choose 3 soldiers with index (i, j, k) such that the rating (rating[i], rating[j], rating[k]).A team will ... Read More

Construct K Palindrome Strings in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 17-Nov-2020 11:33:09

149 Views

Suppose we have a string s and a number k. We have to construct k non-empty palindrome strings using all the characters in s. So here we have to check whether we can use all the characters in s to construct k palindrome strings or not.So, if the input is ... Read More

01 Matrix in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 17-Nov-2020 11:28:52

161 Views

Suppose we have a matrix consists of 0 and 1, we have to find the distance of the nearest 0 for each cell. Here the distance between two adjacent cells is 1.So, if the input is like000010111then the output will be000010121To solve this, we will follow these steps −Define an ... Read More

Longest Uncommon Subsequence II in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 17-Nov-2020 11:26:18

85 Views

Suppose we have a list of strings; we have to find the longest uncommon subsequence among them. The longest uncommon subsequence is actually the longest subsequence of one of these strings and this subsequence should not be any subsequence of the other strings.We know that a subsequence is a sequence ... Read More

Predict the Winner in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 17-Nov-2020 11:23:19

219 Views

Suppose we have an array of scores that are non-negative integers. The first player picks one of the numbers from either end of the array followed by the second player and then the first player and so on. Each time a player picks a number, that number will not be ... Read More

Serialize and Deserialize BST in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 17-Nov-2020 11:19:53

452 Views

Suppose we want to design an algorithm to serialize and deserialize a binary search tree. Serialization is the process of converting something (data structure or object) into a sequence of bits so that it can be stored in a file or memory buffer, or transmitted across a network connection link. ... Read More

All Nodes Distance K in Binary Tree in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 17-Nov-2020 11:14:04

167 Views

Suppose we have a binary tree, a target node, and a one value K. We have to find a list of the values of all nodes that have a distance K from the target node.So, if the input is like root = [3, 5, 1, 6, 2, 0, 8, null, ... Read More

Max Increase to Keep City Skyline in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 17-Nov-2020 11:09:19

187 Views

Suppose we have a 2-dimensional array called grid, where each value of grid[i][j] represents the height of a building located there. We can increase the height of any number of buildings, by any amount. Height 0 is considered to be a building as well. At the end, the "skyline" when ... Read More

Advertisements