We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
publicstaticintbirthday(List<Integer>s,intd,intm){// Write your code hereintcount=0;intsum=0;for(inti=0;i<m;i++){sum+=s.get(i);}if(sum==d){count++;}for(inti=m;i<s.size();i++){sum=sum-s.get(i-m)+s.get(i);if(sum==d){count++;}}returncount;}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Subarray Division
You are viewing a single comment's thread. Return to all comments →
Java Solution
Using Sliding Window Protocal O(n)