Arnab Chakraborty has Published 4293 Articles

Integer Break in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 02-May-2020 07:56:49

292 Views

Suppose we have a positive integer n, we have to break it into the sum of at least two positive numbers and maximize the product of those integers. We have to find the maximum product we can get. So if the number is 10, then the answer will be 36, ... Read More

Reconstruct Itinerary in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 02-May-2020 07:53:32

258 Views

Suppose we have a list of airline tickets represented by pairs of departure and arrival airports like [from, to], we have to reconstruct the itinerary in order. All of the tickets belong to a man who departs from JFK. So, the itinerary must begin with JFK.So if the input is ... Read More

Maximum Product of Word Lengths in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 02-May-2020 07:50:19

486 Views

Suppose we have a string array called words, find the maximum value of length(word[i]) * length(word[j]) where the two words will not share the common letters. We can assume that each word will contain only lower case letters. If no such two words exist, then return 0. So if the ... Read More

H-Index II in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 02-May-2020 07:35:49

277 Views

Suppose we have an array of citations (The citations are non-negative integers) of a researcher. These numbers are sorted in non-decreasing order. We have to define a function to compute the researcher's h-index. According to the definition of h-index: "A scientist has index h if h of his/her N papers ... Read More

H-Index in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 02-May-2020 07:29:02

752 Views

Suppose we have an array of citations (The citations are non-negative integers) of a researcher. We have to define a function to compute the researcher's h-index. According to the definition of h-index: "A scientist has index h if h of his/her N papers have at least h citations each, and ... Read More

Ugly Number II in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 02-May-2020 07:26:14

290 Views

Suppose we have to find the nth ugly number, so we have to define a method that can find it. As we know that the ugly numbers are those numbers, whose prime factors are only 2, 3 and 5. So if we want to find 10th ugly number, that will ... Read More

Single Number III in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 02-May-2020 07:23:28

418 Views

Suppose we have an array, there exactly two elements appear once, but others are appearing twice. So we have to define a function, that will find these two numbers. So if the given array is like [1, 2, 3, 1, 5, 2], then the output will be [3, 5].To solve ... Read More

Different Ways to Add Parentheses in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 02-May-2020 07:21:21

978 Views

Suppose we have a string of numbers and operators, we have to find all possible results from computing all the different possible ways to group the numbers and operators. Here the valid operators are +, - and *. So if the input is like “2*3-4*5”, then the output will be ... Read More

Majority Element II in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 02-May-2020 07:17:52

314 Views

Suppose we have one integer array; we have to find those elements that appear more than floor of n/3. Here n is the size of array.So if the input is like [1, 1, 1, 3, 3, 2, 2, 2], then the results will be [1, 2]To solve this, we will ... Read More

Rectangle Area in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 02-May-2020 07:14:23

381 Views

Suppose we want to find the total area covered by two rectilinear rectangles in a 2D plane. Here each rectangle is defined by its bottom left corner and top right corner as shown in the figure.To solve this, we will follow these steps −if C = E or A >= ... Read More

Advertisements