code everyday with me

–DAY 10–

Hi, I am going to make #100DaysOfCode Challenge. Everyday I will try solve 1 problem from leetcode or hackerrank. Hope you can go with me until end.
Now let’s solve problem today:
-Problem: Subarray Division
-Detail: https://www.h…


This content originally appeared on DEV Community and was authored by duccanhole

--DAY 10--

Hi, I am going to make #100DaysOfCode Challenge. Everyday I will try solve 1 problem from leetcode or hackerrank. Hope you can go with me until end.
Now let's solve problem today:
-Problem: Subarray Division
-Detail: https://www.hackerrank.com/challenges/the-birthday-bar/problem
-My solution (javascript):

function birthday(arr, d, m) {
    let ans=0,s=0;
    for(let i=0;i<arr.length;i++){
        for(let j=i;j<(i+m);j++) s+=arr[j];
        if(s==d) ans++;
        s=0;
    }
    return ans;
}

-->If you have better solution or any question, please comment below. I will appreciate.


This content originally appeared on DEV Community and was authored by duccanhole


Print Share Comment Cite Upload Translate Updates
APA

duccanhole | Sciencx (2021-10-28T09:43:44+00:00) code everyday with me. Retrieved from https://www.scien.cx/2021/10/28/code-everyday-with-me/

MLA
" » code everyday with me." duccanhole | Sciencx - Thursday October 28, 2021, https://www.scien.cx/2021/10/28/code-everyday-with-me/
HARVARD
duccanhole | Sciencx Thursday October 28, 2021 » code everyday with me., viewed ,<https://www.scien.cx/2021/10/28/code-everyday-with-me/>
VANCOUVER
duccanhole | Sciencx - » code everyday with me. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/10/28/code-everyday-with-me/
CHICAGO
" » code everyday with me." duccanhole | Sciencx - Accessed . https://www.scien.cx/2021/10/28/code-everyday-with-me/
IEEE
" » code everyday with me." duccanhole | Sciencx [Online]. Available: https://www.scien.cx/2021/10/28/code-everyday-with-me/. [Accessed: ]
rf:citation
» code everyday with me | duccanhole | Sciencx | https://www.scien.cx/2021/10/28/code-everyday-with-me/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.