239. Sliding Window Maximum || NEETCODE 150

Поделиться
HTML-код
  • Опубликовано: 5 ноя 2024

Комментарии • 8

  • @TechWithSaumya
    @TechWithSaumya  9 месяцев назад

    EDIT: Space Complexity will be O(K) .

  • @ankitraj2283
    @ankitraj2283 9 месяцев назад

    Done ✅✅

  • @revolutionaryhindu0001
    @revolutionaryhindu0001 9 месяцев назад

    जय श्री राम बहना 🙏🏻🙏🏻

  • @inspireyou_125
    @inspireyou_125 9 месяцев назад

    Didi aaj maine 4 video complete ki hai jo skip ho gye thi exam ki wajah se. Thank you so much Didi.😊 & Didi 😊 Jay shree Ram🙏

  • @prathamgoel3386
    @prathamgoel3386 9 месяцев назад

    Brute Force Approach
    class Solution {
    public int[] maxSlidingWindow(int[] nums, int k) {
    int n = nums.length;
    List res = new ArrayList();
    for (int i = 0; i < n - k + 1; i++) {
    int max = nums[i];
    for (int j = 1; j < k; j++) {
    max = Math.max(max, nums[i + j]);
    }
    res.add(max);
    }
    int[] resultArray = res.stream().mapToInt(Integer::intValue).toArray();
    return resultArray;
    }
    }

  • @rudycramer225
    @rudycramer225 9 месяцев назад

    I am sure YOU know what you are talking about! You talk too quick and the whiteboard drawings are just a scrawl. I could not follow it. I get what you are trying to do about sliding to the right showing the next three numbers. Would have been nice if you also showed it in action. Very hard to watch. Talk slower and neaten up you writing. Again, you obviously know what you are on about.