HackerRank Java Coding Questions and Answers Disk Space Analysis Problem Statement -: You are given an array, You have to choose a contiguous subarray of length ‘k’, and find the minimum of that segment, return the maximum of those minimums. Sample input 1 → Length of segment x =1 5 → size of space n = 5 1 → space = [ 1,2,3,1,2] 2 3 1 2 Sample output 3 Explanation The subarrays of size x = 1 are [1],[2],[3],[1], and [2],Because each subarray only contains 1 element, each value is minimal with respect to the subarray it is in. The maximum of these values is 3. Therefore, the answer is 3 Program : // Hackerrank Java Coding Questions and Answers // Disk Space Analysis import java.util.*; class DiskSpace { public static void main(String[] args) { Scanner sc=new Scanner(System.in); System.out.println...
Comments
Post a Comment