
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Narendra Kumar has Published 191 Articles

Narendra Kumar
211 Views
Problem statementGiven an array, we partition a row of numbers A into at most K adjacent (non-empty) groups, then the score is the sum of the average of each group. What is the maximum score that can be scored?ExampleIf input array is {9, 2, 5, 3, 10} then we can ... Read More

Narendra Kumar
257 Views
Problem statementGiven an array arr[] and two integers X and Y. The task is to find a sub-array of size of at least X and at most Y with the maximum averageExampleIf input array is {2, 10, 15, 7, 8, 4} and x = 3 and Y = 3 then ... Read More

Narendra Kumar
189 Views
Problem statementGiven two same sized arrays A[] and B[]. Task is to form a third array of same size. The result array should have maximum n elements from both array. It should have chosen elements of A[] first, then chosen elements of B[] in same order as they appear in ... Read More

Narendra Kumar
309 Views
Problem statementGiven four sides of quadrilateral a, b, c, d, find the maximum area of the quadrilateral possible from the given sides.AlgorithmWe can use below Brahmagupta’s formula to solve this problem −√(s-a)(s-b)(s-c)(s-d)In above formula s is semi-perimeter. It is calculated as follows −S = (a + b + c + ... Read More

Narendra Kumar
670 Views
Problem statementGiven an array of n positive elements. we need to find the maximum bitwise AND value generated by any pair of element from the array.ExampleIf input array is {10, 12, 15, 18} then maximum value of bitwise AND is 12.AlgorithmThe result of bitwise AND operations on single bit is ... Read More

Narendra Kumar
217 Views
Problem statementGiven a square matrix of order n*n, find the maximum and minimum from the matrixExampleIf given matrix is −{{15, 17, 19}, {5, 1, 7}, {14, 5, 16}} then Minimum number is 1 and maximum number is 19AlgorithmSelect two elements from the matrix one from the start of a row ... Read More

Narendra Kumar
861 Views
Problem statementGiven a number n, the task is to find the maximum 0’s between two immediate 1’s in binary representation of given n. Return -1 if binary representation contains less than two 1’sExampleIf input number is 35 then its binary representation is −00100011In above binary representation there are 3 0’s ... Read More

Narendra Kumar
340 Views
Problem statementGiven a minimum heap find maximum element in that.ExampleIf input heap is −Then maximum element is 55AlgorithmIn minimum heap parent node will be lesser than its children. Hence we can conclude that a non-leaf node cannot be the maximum.Search maximum element in the leaf nodesExampleLet us now see an ... Read More

Narendra Kumar
359 Views
Problem statementGiven two arrays of equal size N, form maximum number of pairs by using their elements, one from the first array and second from the second array, such that an element from each array is used at-most once and the absolute difference between the selected elements used for forming ... Read More

Narendra Kumar
368 Views
Problem statementGiven an array of N integers, rearrange the array elements such that the next array element is greater than the previous element arr[i+1] > arr[i]ExampleIf input array is {300, 400, 400, 300} then rearranged array will be −{300, 400, 300, 400}. In this solution we get 2 indices with ... Read More