Navigation X
ALERT
Click here to register with a few steps and explore all our cool stuff we have to offer!



 1893

⭐[MEGA.NZ]⭐ ❤️TEEN PACK LEAKS #19❤️ ( 440GB) 2024 V5

by PornLeak - Yesterday - 07:42 AM
This post is by a banned member (xeidodio) - Unhide
xeidodio  
Registered
55
Posts
0
Threads
thanks
This post is by a banned member (jullesarne9) - Unhide
125
Posts
0
Threads
Thanks m8!
This post is by a banned member (cuminarid) - Unhide
cuminarid  
Registered
43
Posts
0
Threads
1 Year of service
class Solution {
    public int[] resultsArray(int[] nums, int k) {
        int n = nums.length;
        int[] ans = new int[n - k + 1];
        int cnt = 0; // Count of consecutive increasing numbers

        for (int i = 0; i < n - 1; i++) {
            // Check for increasing consecutive numbers
            if (nums[i + 1] == nums[i] + 1) {
                cnt++;
            } else {
                cnt = 0; // Reset count if not consecutive
            }

            // When we have enough elements to form a subarray of size k
            if (i - (k - 2) >= 0) {
                int idx = i - (k - 2); // Starting index of the subarray
                if (cnt >= k - 1) {
                    // Subarray meets the criteria
                    ans[idx] = nums[i + 1]; // Maximum element of the subarray
                } else {
                    // Subarray does not meet the criteria
                    ans[idx] = -1;
                }
            }
        }

        return ans;
    }
}
This post is by a banned member (William3011) - Unhide
41
Posts
0
Threads
Thanks
This post is by a banned member (detoxe3331) - Unhide
242
Posts
0
Threads
ty
This post is by a banned member (Eglizzabeth) - Unhide
156
Posts
0
Threads
1 Year of service
Pz
This post is by a banned member (Ygbg) - Unhide
Ygbg  
Registered
3
Posts
0
Threads

monkayes
This post is by a banned member (altsicheng) - Unhide
41
Posts
0
Threads
(This post was last modified: 1 hour ago by altsicheng.)
tyyy

tyyyyyyys

Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
or
Sign in
Already have an account? Sign in here.


Forum Jump:


Users browsing this thread: imeanwhaaa, LilT78, 11 Guest(s)