- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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 196 Articles
![Narendra Kumar](https://www.tutorialspoint.com/articles/images/user_icon.png)
Narendra Kumar
554 Views
Problem statementGiven an Array of Positive and Negative Integers, find out the Maximum Subarray Sum in that ArrayExampleIf input array is − {-12, -5, 4, -1, -7, 1, 8, -3} then output is 9AlgorithmCalculate the prefix sum of the input array.Initialize− min_prefix_sum = 0, res = -infiniteMaintain a loop for ... Read More
![Narendra Kumar](https://www.tutorialspoint.com/articles/images/user_icon.png)
Narendra Kumar
621 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](https://www.tutorialspoint.com/articles/images/user_icon.png)
Narendra Kumar
123 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](https://www.tutorialspoint.com/articles/images/user_icon.png)
Narendra Kumar
556 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](https://www.tutorialspoint.com/articles/images/user_icon.png)
Narendra Kumar
235 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](https://www.tutorialspoint.com/articles/images/user_icon.png)
Narendra Kumar
140 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](https://www.tutorialspoint.com/articles/images/user_icon.png)
Narendra Kumar
93 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](https://www.tutorialspoint.com/articles/images/user_icon.png)
Narendra Kumar
253 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](https://www.tutorialspoint.com/articles/images/user_icon.png)
Narendra Kumar
265 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](https://www.tutorialspoint.com/articles/images/user_icon.png)
Narendra Kumar
167 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