Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 40121

Minimum Value

$
0
0

Hello fellow codesters,
I need a lil help from you guys
I'd like to find the Minimum Value for every set of a constant number of values in an array !!
like,
i need to find the minimum for every 5 values in an array of size 10,

input array :
1 2 3 4 5 6 7 8 9 10
o/p array :
1 2 3 4 5 6

Explanation :
Min of (1,2,3,4,5) = 1
Min of (2,3,4,5,6) = 2
Min of (3,4,5,6,7) = 3
Min of (4,5,6,7,8) = 4
Min of (5,6,7,8,9) = 5
Min of (6,7,8,9,10) = 6
Is it possible to achieve the result in O(n) time ??


Viewing all articles
Browse latest Browse all 40121

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>