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 →
Data Structures
5 postsPrint 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 a n*m chess board. We can choose any rectangle formed by board squares and perform an inversion. Every white cell in the inverted rectangle becomes black and every black one becomes Read more →
Given an arithmetic progression and having any number of duplicates, we have to find the index of first occurrence of duplicate element in the series. After getting the index we will remove 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 an array of positive integers we have to find number of pair of elements whose difference is smaller than average difference. Average difference is defined as (max(A)-min(A))/(n-1), where A is the array and Read more →
Given a matrix mat[][] of size M x N integers where M is the number of rows and N is the number of columns and a number K. The task is to Read more →
Given heights of n rectangles and two positive integers x and y. You start moving from the rectangle at 0th index. In one move you can perform one of the following operations: Read more →
Sort a list in JAVA and then return the index of elements in sorted order. Examples: Input : [2, 3, 1, 4, 5] Output : [2, 0, 1, 3, 4] After sorting Read more →