Sudhir sharma has Published 1149 Articles

Find K items with the lowest values in C++

sudhir sharma

sudhir sharma

Updated on 25-Jan-2021 04:51:25

130 Views

In this problem, we are given a list that consists of items and their values and an integer k. Our task is to find K items with the lowest values. Problem description: We need to find k items from the list that have the lowest value.Let’s take an example to understand the ... Read More

Find index of an extra element present in one sorted array in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2021 14:08:10

712 Views

In this problem, we are given two sorted arrays arr1 and arr2 of size n  and n+1 with all elements the same except the extra element. Our task is to find index of an extra element present in one sorted array. Problem Description: We need to find the index of an element ... Read More

Find if two people ever meet after same number of jumps in C++

sudhir sharma

sudhir sharma

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

303 Views

In this problem, we are given four integers denoting the starting points and jumps taken by each in the race. Our task is to find if two people ever meet after same number of jumps.  Problem Description: Here, we need to check if two persons starting at points p1 and p2 taking ... Read More

Find if there is any subset of size K with 0 sum in an array of -1 and +1 in C++

sudhir sharma

sudhir sharma

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

170 Views

In this problem, we are given an array arr[] consisting of only 1 and -1 and an integer value k. Our task is to find if there is any subset of size K with 0 sum in an array of -1 and +1. Let’s take an example to understand the problem, ... Read More

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

318 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

121 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

388 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

264 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

366 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

107 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

Advertisements