"Coding is just like talking to a unknown girl. Once you talked to her with guts, the next time you'll never afraid",Really? Yes , try it Now !!!
Everything here is for education and learning purpose only , individual holds rights on outer posts/links etc.
Team Cracking The Code
2 comments :
Your solution does not find sub-arrays of size r. It finds all sub-sequences of size r. Sub-arrays are contiguous, which sub-sequences are not.
Given an array of size 3 there can be n-r+1 such sub-arrays.
n=3, r=2, A = [1, 2, 3]
all possible subarrays of size r = {[1,2], [2,3]}
@anon , thanks for correcting , i have updated it , keep it up !!!
Post a Comment