3206 & 3208. Alternating Groups II | 3206. Alternating Groups I | Not Sliding Window

Поделиться
HTML-код
  • Опубликовано: 5 июл 2024
  • In this video, I'll talk about how to solve Leetcode 3208. Alternating Groups II | 3206. Alternating Groups I | Not Sliding Window | Alternating Count
    Let's Connect:
    📱Discord (Join Community) : / discord
    📝Linkedin: / aryan-mittal-0077
    📸 Instagram: / codewitharyanbhai
    💻 Twitter - / aryan_mittal007
    🤖 Github: github.com/aryan-0077
    About Me:
    I am Aryan Mittal - A Software Engineer in Goldman Sachs, Speaker, Creator & Educator. During my free time, I create programming education content on this channel & also how to use that to grow :)
    ✨ Hashtags ✨
    #programming #Interviews #leetcode #faang #maang #datastructures #algorithms

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

  • @user-xg2vg4px5l
    @user-xg2vg4px5l 28 дней назад +4

    THE BEST SOLTION !!!!!!!!!!! 👍👍👍👍

  • @ganeshjaggineni4097
    @ganeshjaggineni4097 28 дней назад +1

    NICE SUPER EXCELLENT MOTIVATED

  • @soumyadeepghosh4428
    @soumyadeepghosh4428 28 дней назад +2

    Can you share all the tips and tricks of different data structures required for acing leetcode contests please ??

  • @user-xr3bi6tm6v
    @user-xr3bi6tm6v 28 дней назад

    crystal clear explanation!!!👌👌👍👍

  • @user-do1eq7tl3e
    @user-do1eq7tl3e 25 дней назад

    14:00 ,so much needed during this contest.

  • @manojnoochila
    @manojnoochila 28 дней назад +2

    The way he told maksaad😂💀💀

  • @jayanthmarupaka9381
    @jayanthmarupaka9381 28 дней назад

    understood!!🎉🎉

  • @rajakumar9956
    @rajakumar9956 28 дней назад +3

    No, Sliding window approach will still work, we just have to count number of violations while traversing the array, which will help to calculate the ans..
    I had submitted this sliding window approach, it got accepted without any issues

    • @ok-google-run
      @ok-google-run 28 дней назад

      but how will you keep track of the valid windows?

    • @rajakumar9956
      @rajakumar9956 28 дней назад

      @@ok-google-run
      class Solution {
      public int numberOfAlternatingGroups(int[] nums, int k) {

      int n = nums.length;

      //Extend the array
      int[] newnums = new int[n+k-1];
      for(int i=0;i

    • @rajakumar9956
      @rajakumar9956 28 дней назад

      @@ok-google-run class Solution {
      public int numberOfAlternatingGroups(int[] nums, int k) {
      int n = nums.length;
      //Extend the array
      int[] newnums = new int[n+k-1];
      for(int i=0;i

    • @rajakumar9956
      @rajakumar9956 28 дней назад

      ​@@ok-google-run I had added the solution in comment!

  • @IK-xk7ex
    @IK-xk7ex 28 дней назад

    I get stuck with that problem yesterday on contest. ((((

  • @rajakumar9956
    @rajakumar9956 28 дней назад +1

    Sliding window solution:
    class Solution {
    public int numberOfAlternatingGroups(int[] nums, int k) {
    int n = nums.length;
    //Extend the array
    int[] newnums = new int[n+k-1];
    for(int i=0;i

  • @darshanvanjara
    @darshanvanjara 28 дней назад +1

    bhaiya aap konsi college se ho?

  • @shashanktiwari6999
    @shashanktiwari6999 28 дней назад

    Can't we use prefix sum with sliding window?

    • @harshitkumar8988
      @harshitkumar8988 28 дней назад

      ofc we do but in 2nd type of problem it give TLE

    • @shashanktiwari6999
      @shashanktiwari6999 28 дней назад

      @@harshitkumar8988 why should it give tle we are traversing array for only O(n+k)?