In this article, we will discuss some of similar questions that are easy to solve with few changes in solution codes. Leetcode is a platform to practice DSA problems for those who Read more →
C++ Programs
155 postsGiven an array of size n, your task is to find the least common multiple or LCM of all the elements of the array. Examples: Input : arr = [ 8, 9, Read more →
We have to find a Matrix of order 3 formed by given 9-elements whose determinant is maximum. Examples: Input: arr[9] = { 1, 2, 3, 4, 5, 6, 7, 8, 9} Max Read more →
The first few terms(Fn) of Fibonacci Numbers are 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, … For given N find the sum (Sn) of 0 Read more →
Print all the perfect squares in a range i.e. a and b are the lower and upper bounds respectively. So print all the perfect squares between them and both are inclusive. Examples: Read more →
Given first N natural numbers. Our task is to check whether is it possible to split the numbers in two sets such that absolute difference of the sum of numbers in the Read more →
Given an array of unique integers, print the array in such a way that the first element is first maximum and second element is first minimum and so on. We have to Read more →
LRU cache implementation: Here we have two methods get and set which are defined as follows: get(x) : If the key x exists in the cache, returns its value and update reference Read more →
Given N and M, distribute first N natural numbers in two sets such that the absolute sum of the numbers in the two sets is equal to M. If possible, print the Read more →
A sequence, whose nth term is defined by: Tn = (n)2 – (n – 1)2. The task is to calculate the sum of first n term of the sequence i.e find Sn Read more →