Sudhir sharma has Published 1206 Articles

Find larger of x^y and y^x in C++

sudhir sharma

sudhir sharma

Updated on 25-Jan-2021 04:55:33

132 Views

In this problem, we are given two numbers x and y. Our task is to find larger of x^y and y^x. Problem Description: The problem is simple, we need to find weather x to the power y is greater than y to the power x.Let’s take an example to understand the problem, ... Read More

Find k-th smallest element in given n ranges in C++

sudhir sharma

sudhir sharma

Updated on 25-Jan-2021 04:55:13

271 Views

In this problem, we are given n ranges and an integer k. Our task is to find k-th smallest element in given n ranges. We need to find the kth smallest elements from the array which is created after combining the ranges.Let’s take an example to understand the problem,  Input: ranges = ... Read More

Find kth node from Middle towards Head of a Linked List in C++

sudhir sharma

sudhir sharma

Updated on 25-Jan-2021 04:54:49

344 Views

In this problem, we are given a linked-list and a number k. Our task is to find kth node from Middle towards the Head of a Linked List. Let’s take an example to understand the problem,  Input: linked-list : 4 -> 2 -> 7 -> 1 -> 9 -> 12 -> 8 ... Read More

Find kth smallest number in range [1, n] when all the odd numbers are deleted in C++

sudhir sharma

sudhir sharma

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

140 Views

In this problem, we are given two integer values n and k. Our task is to find kth smallest number in range [1, n] when all the odd numbers are deleted. We need to find the kth smallest number in the range [1, n] which contains only even values.So, from range ... Read More

Find k maximum elements of array in original order in C++

sudhir sharma

sudhir sharma

Updated on 25-Jan-2021 04:52:14

98 Views

In this problem, we are given an array arr[] of n elements. Our task is to find k maximum elements of the array in original order. We need to find k maximum elements of the array and then print then as they were indexed originally.Let’s take an example to understand the ... Read More

Find integers that divides maximum number of elements of the array in C++

sudhir sharma

sudhir sharma

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

272 Views

In this problem, we are given an array arr[] of n integers.Our task is to find integers that divides maximum number of elements of the array. Problem Description: We need to find a number p which can divide the maximum number of elements of the array. In case, there are more than one ... Read More

Find K items with the lowest values in C++

sudhir sharma

sudhir sharma

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

68 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

548 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

229 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

103 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

Advertisements