LeetCode 713 | Subarray Product Less Than K | Solution Explained (Java + Whiteboard)

Поділитися
Вставка
  • Опубліковано 11 жов 2024
  • Your are given an array of positive integers nums.
    Count and print the number of (contiguous) subarrays where the product of all the elements in the subarray is less than k.
    Example 1:
    Input: nums = [10, 5, 2, 6], k = 100
    Output: 8
    Explanation: The 8 subarrays that have product less than 100 are: [10], [5], [2], [6], [10, 5], [5, 2], [2, 6], [5, 2, 6].
    Note that [10, 5, 2] is not included as the product of 100 is not strictly less than k.
    Running Time: O(N)
    Space Complexity: O(1)
    Always be pluggin:
    Slack Channel: join.slack.com...
    Github: github.com/xav...
    Facebook: / xavier.hollingsworth.3
    Instagram: / xavierelon
    LinkedIn: / xavier-hollingsworth-5...
    Twitter: / elon_xavier

КОМЕНТАРІ • 5

  • @rahulpothula1902
    @rahulpothula1902 2 роки тому

    Very good video...perfectly underrstood. BTW what about the slack channel??

    • @xavierelon
      @xavierelon  2 роки тому

      Hi the Slack channel is currently inactive. I might try to reboot it. And thank you

  • @deliveringIdeas
    @deliveringIdeas 2 роки тому

    If we are trying to count the number of subarrays, why not just use count++?

  • @symbol767
    @symbol767 2 роки тому +1

    I truly hate these array problems... I rather have all trees and graphs on my interviews than these nonsense problems...

  • @martinberger365
    @martinberger365 10 місяців тому

    Bit confusing 😂