Sudhir sharma has Published 1206 Articles

Find if k bookings possible with given arrival and departure times in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2021 14:06:24

237 Views

In this problem, we are given two arrays  consisting of N values denoting arrival and departure at hotel and an integer k. Our task is to find if k bookings are possible with given arrival and departure times. Problem Description: Here, we need to check if the hotel with k rooms is ... Read More

Find if there is a pair in root to a leaf path with sum equals to root's data in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2021 14:06:11

61 Views

In this problem, we are given a Binary Tree. And we need to find if there is a pair in root to a leaf path with sum equals to root’s data. We need to check if there exists a pair of nodes that lies between root node to leaf nodes such ... Read More

Find if there is a subarray with 0 sum in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2021 14:05:59

296 Views

In this problem, we are given an array arr[] of size n consisting of integer values. Our task is to find if there is a subarray with 0 sum. We need to check whether the given array contains a sub-array in which the sum of all elements is equal to 0.Let’s ... Read More

Find if given matrix is Toeplitz or not in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2021 14:02:51

162 Views

In this problem, we are given a 2D square matrix mat[][] of size n*n. Our task is to find if the given matrix is Toeplitz or not.Toeplitz matrix also known as diagonal matrix is a matrix in which the elements at the diagonal start from top-left corner to bottom-right corner.Let’s take ... Read More

Find if given number is sum of first n natural numbers in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2021 14:02:30

216 Views

In this problem, we are given a number num. Our task is to find if the given number is the sum of first n natural numbers.  Problem Description: Here, we need to check whether the given number is the sum of first n natural numbers.Let’s take an example to understand the problem, ... Read More

Find if it's possible to rotate the page by an angle or not in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2021 14:02:15

53 Views

In this problem, we are given coordinates of three points that lie on a page. Our task is to find if it’s possible to rotate the page by an angle or not.  The rotation of the page is made in such a way that the new position of ‘x’ is the ... Read More

Find if array has an element whose value is half of array sum in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2021 13:53:43

149 Views

In this problem, we are given an array arr of sorted unique values. Our task is to find if array has an element whose value is half of array sum. Problem Description: For the array arr[], we need to find element x in the array such that the sum of all elements ... Read More

Find if a string starts and ends with another given string in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2021 13:53:31

466 Views

In this problem, we are given two strings str and corStr. Our task is to find if a string starts and ends with another given string. Let’s take an example to understand the problem, Input: str = “abcprogrammingabc” conStr = “abc”Output: TrueSolution Approach: To solve the problem, we need to check if the string ... Read More

Find if a number is divisible by every number in a list in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2021 13:53:18

203 Views

In this problem, we are given a list of n numbers and a number. Our task is to find if a number is divisible by every number in a list. We need to check if the given number divides all elements of the list or not.Let’s take an example to understand ... Read More

File opening modes(r versus r+) in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2021 13:49:44

3K+ Views

File handling in programming languages is very important for the interaction of programming with the memory for accessing files and fetching data in it.Using a program, you can read data from a file as well as write data to the file and do a lot more functions.Here, we will see reading ... Read More

Advertisements