Arnab Chakraborty has Published 4293 Articles

Check if a string can be converted to another string by replacing vowels and consonants in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-Dec-2020 13:05:33

377 Views

Suppose we have two strings s and t. We can only change a character at any position to any vowel if it is already a vowel or to a consonant if it is already a consonant. We have to check whether s can be represented to t or vice-versa.So, if ... Read More

Check if a sorted array can be divided in pairs whose sum is k in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-Dec-2020 13:03:30

141 Views

Suppose we have an array of numbers and have another number k, we have to check whether given array can be divided into pairs such that the sum of every pair is k or not.So, if the input is like arr = [1, 2, 3, 4, 5, 6], k = ... Read More

Check if a queue can be sorted into another queue using a stack in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-Dec-2020 13:02:15

333 Views

Suppose we have a Queue with first n natural numbers (unsorted). We have to check whether the given Queue elements can be sorted in non-decreasing sequence in another Queue by using a stack. We can use following operations to solve this problem −Push or pop elements from stackDelete element from ... Read More

Check if a Queen can attack a given cell on chessboard in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-Dec-2020 13:00:31

726 Views

Suppose we have two coordinates on a chessboard for queen and opponent. These points are Q and O respectively. We have to check whether the queen can attack the opponent or not. As we know that the queen can attack in the same row, same column and diagonally.So, if the ... Read More

Check if a prime number can be expressed as sum of two Prime Numbers in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-Dec-2020 12:58:49

921 Views

Suppose we have a prime number n. we have to check whether we can express n as x + y where x and y are also two prime numbers.So, if the input is like n = 19, then the output will be True as we can express it like 19 ... Read More

Check if a point lies on or inside a rectangle in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-Dec-2020 12:57:09

6K+ Views

Suppose we have a rectangle represented by two points bottom-left and top-right corner points. We have to check whether a given point (x, y) is present inside this rectangle or not.So, if the input is like bottom_left = (1, 1), top_right = (8, 5), point = (5, 4), then the ... Read More

Program to Find Out the Smallest Substring Containing a Specific String in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 26-Dec-2020 11:57:01

1K+ Views

Suppose we have two strings s and t. We have to find the smallest substring in s, where t is also a subsequence of the substring. If that type of substring does not exist, we will return a blank string, and if there are multiple smallest substrings, we will take ... Read More

Program to Find Out Median of an Integer Array in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 26-Dec-2020 11:55:00

307 Views

Suppose we have to implement a class named MedianClass which contains the following methods −add(value) which adds a value to the data structure.median() finds the median of all the numbers currently present in the data structure.So, if we add 5, 3, 8 and find median, the output will be 5.0, ... Read More

Program to Find Out Integers Less than n Containing Multiple Similar Digits in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 26-Dec-2020 11:29:16

211 Views

Suppose we have an integer n, we have to find the number of positive integers that are less than or equal to n, where the integer numbers at least have a digit occurring more than once.So, if the input is like n = 200, then the output will be 38To ... Read More

Program to Reverse a Substring Enclosed Within Brackets in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 26-Dec-2020 11:27:50

520 Views

Suppose, we have a lowercase string s that contains letters and parentheses "(" and ")". We have to reverse every string enclosed within parentheses in a recursive manner and return the resultant string.So, if the input is like s = "back(aps)ce", then the output will be “backspace”.To solve this, we ... Read More

Advertisements