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.
- Subarray Division 1
- Discussions
Subarray Division 1
Subarray Division 1
Sort by
recency
|
255 Discussions
|
Please Login in order to post a comment
Fastest Python solution!!! Solution uses sliding window or queue (which ever makes it easier for you to think about this problem.) Solution also uses some savvy indexing math.
int birthday(vector s, int d, int m) {
//Here We Follow Sliding Window Technque instead of sunsequence because continous segment if no need of cotinuous sement then we can solve it using subsequence technique int run = s.size() - m + 1; int count = 0; for(int i = 0;i
}
Java solution using a Queue:
This is my Java solution: Take notice of the loop ending condition, it took me more than I would've wanted to notice that I had to loop until i <= n - m, not i < n -m.
Mail: mst29310@gmail.com