
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
763 Views
Problem statementGiven an array of N elements and sum. We need to find size of maximum size subset whose sum is equal to given sumExampleIf input array is arr = { 2, 3, 5, 10 } and sum = 20 then output will be 4 as −2 + 3 + ... Read More

Narendra Kumar
203 Views
Problem statementGiven n wines in a row, with integers denoting the cost of each wine respectively. Each year you can sale the first or the last wine in the row. The price of wines increases over time. Let the initial profits from the wines be P1, P2, P3…Pn. On the ... Read More

Narendra Kumar
712 Views
Problem statementGiven an array of n integers and q queries, each query having a range from l to r. Find the maximum prefix-sum for the range l – r.ExampleIf input array is arr[] = {-1, 2, 3, -5} and queries = 2 and ranges are: l = 0, r = ... Read More

Narendra Kumar
309 Views
Problem statementGiven an Array of non-negative integers. Find out three elements from the array which form a triangle of maximum perimeterExampleIf input array is {5, 1, 3, 5, 7, 4} then maximum perimeter is (7 + 5 + 5) = 17AlgorithmSort the array in non-increasing order. So, the first element ... Read More

Narendra Kumar
207 Views
Problem statementGiven two arrays of positive integers. Select two sub-arrays of equal size from each array and calculate maximum possible OR sum of the two sub-arrays.ExampleIf arr1[] = {1, 2, 4, 3, 2} andArr2[] = {1, 3, 3, 12, 2} then maximum result is obtained when we create following two ... Read More

Narendra Kumar
186 Views
Problem statementGiven a permutation of N elements from 0 to N-1. A fixed point is an index at which the value is same as the index i.e. arr[i] = i. You are allowed to make at most 1 swap. Find the maximum number of fixed points that you can get.ExampleIf ... Read More

Narendra Kumar
331 Views
Problem statementA tree is always a Bipartite Graph as we can always break into two disjoint sets with alternate levels.In other words, we always color it with two colors such that alternate levels have same color. The task is to compute the maximum no. of edges that can be added ... Read More

Narendra Kumar
349 Views
Problem statementGiven an integer N which represents the number of Vertices. The Task is to find the maximum number of edges possible in a Bipartite graph of N vertices.Bipartite GraphA Bipartite graph is one which is having 2 sets of vertices.The set are such that the vertices in the same ... Read More

Narendra Kumar
246 Views
Problem statementGiven a string comprising of ones and zeros. The task is to find the maximum length of the segments of string such that a number of 1 in each segment is greater than 0ExampleIf input string is “10111000001011” the answer will 12 as follows −First segment is of length ... Read More

Narendra Kumar
145 Views
Problem statementGiven lengths of n rods in an array. If any person picks any rod, half of the longest rod (or (max + 1) / 2 ) is assigned and remaining part (max – 1) / 2 is put back. It may be assumed that sufficient number of rods are ... Read More