4월 2, 2019의 게시물 표시

HackerRank Java Subarray

문제 링크 :  https://www.hackerrank.com/challenges/java-negative-subarray/problem We define the following: A  subarray  of an  -element array is an array composed from a contiguous block of the original array's elements. For example, if  , then the subarrays are  ,  ,  ,  ,  , and  . Something like   would  not be a subarray as it's not a contiguous subsection of the original array. The  sum  of an array is the total sum of its elements. An array's sum is  negative  if the total sum of its elements is negative. An array's sum is  positive  if the total sum of its elements is positive. Given an array of   integers, find and print its number of  negative subarrays  on a new line. Input Format The first line contains a single integer,  , denoting the length of array  . The second line contains   space-separated integers describi...