Sitemap

Member-only story

Practice Programming Problems

4 min readFeb 8, 2018

--

Press enter or click to view image in full size

If you are a programmer or a developer it is good to stay sharp on your coding skills. In this article we will explore some practice programming problems using the C -Programming language.

Find The Smallest Positive Integer Value

Problem: Given a sorted array that is in non-decreasing order and made of positive integers, find the smallest positive integer value that cannot be represented as a sum of the elements of any subset of the given set. You are expected to solve this in O(n) time.

Example 1:
Input: arr[] = {1,3,6,10,11,15};
Output: 2

Example 2:
Input: arr[] = {1,1,1,1}
Output: 5

Example 3:
Input: arr[] = {1,1,3,4}
Output: 10

Example 4:
Input: arr[] = {2}
Output: 1

Get the solution code below:

--

--