Arnab Chakraborty has Published 4293 Articles

Best Meeting Point in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Jul-2020 08:05:42

262 Views

Suppose there is a group of two or more people and they wants to meet and minimize the total travel distance. We have a 2D grid of values 0 or 1, where each 1 mark the home of someone in the group. The distance is calculated using the formula of ... Read More

Word Pattern II in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Jul-2020 08:03:39

271 Views

Suppose we have a pattern and a string called str, we have to check whether str follows the same pattern or not. Here pattern follow means a full match, such that there is a bijection between a letter in pattern and a non-empty substring in str.So, if the input is ... Read More

Closest Binary Search Tree Value II in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Jul-2020 08:00:41

429 Views

Suppose we have a binary search tree and a target value; we have to find k values in that BST that are closest to the target. We have to keep in mind that the target value is a floating-point number. We can assume k is always valid, and k ≤ ... Read More

Alien Dictionary in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Jul-2020 07:55:11

558 Views

Suppose there is a new alien language and that uses the latin alphabet. However, the order among letters are not known. We have a list of non-empty words from the dictionary, these words are sorted lexicographically by the rules of this new language. we have to find the order of ... Read More

Paint House II in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Jul-2020 07:52:38

437 Views

Suppose we have n houses in a row, now each house can be painted with one of the k colors. The painting cost of each house with a certain color is different. Now we have to keep in mind that we have to paint all the houses such that no ... Read More

Strobogrammatic Number III in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Jul-2020 07:50:23

636 Views

Suppose we want to define a function to count the total strobogrammatic numbers that exist in the range of (low and high). As we know that a strobogrammatic number is a number that looks the same when rotated 180 degrees.So, if the input is like low = "50", high = ... Read More

Reordered Power of 2 in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Jul-2020 19:00:29

256 Views

Suppose we have a positive integer N, we reorder the digits in any order (including the original order) such that the leading digit is non-zero. We have to check whether we can do this in a way such that the resulting number is a power of 2. So if the ... Read More

Static Finger Theorem in Data Structure

Arnab Chakraborty

Arnab Chakraborty

Updated on 13-Jul-2020 09:16:10

185 Views

STATIC FINGER THEOREM − Let f is treated as a specific element called the finger.Then the below expression is a bound on the cost of splaying a sequenceO(m + n log(n) + Σ Sum log (|f - i[j]| + 1))jNOTE − |f-i| is denoted as the distance in the symmetric ... Read More

Timer in C++ using system calls

Arnab Chakraborty

Arnab Chakraborty

Updated on 13-Jul-2020 08:40:17

934 Views

Here we will see how to design timer in C++ using a system call. We will not use any graphics or animations. Here timer means the stopwatch, that is up-counting the time. The used system calls are −sleep(n) − This will help the program to sleep for n number of ... Read More

Symmetric Min-Max Heaps

Arnab Chakraborty

Arnab Chakraborty

Updated on 13-Jul-2020 07:15:03

2K+ Views

A symmetric min-max heap (SMMH) is defined as a complete binary tree in which each node except the root has exactly one element. The root of an SMMH be empty and the total number of nodes in the SMMH is m + 1, where m is the number of elements.Let ... Read More

Advertisements