3206 & 3208. Alternating Groups II | 3206. Alternating Groups I | Not Sliding Window
Вставка
- Опубліковано 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/ary...
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
THE BEST SOLTION !!!!!!!!!!! 👍👍👍👍
NICE SUPER EXCELLENT MOTIVATED
Can you share all the tips and tricks of different data structures required for acing leetcode contests please ??
14:00 ,so much needed during this contest.
crystal clear explanation!!!👌👌👍👍
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
but how will you keep track of the valid windows?
@@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
@@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
@@ok-google-run I had added the solution in comment!
understood!!🎉🎉
The way he told maksaad😂💀💀
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
I get stuck with that problem yesterday on contest. ((((
bhaiya aap konsi college se ho?
NIT Allahabad
Am i Dumb ?? I spent 2 hrs still can't feeeeel the solution !!? DEMOTIVATED :(((((((
Can't we use prefix sum with sliding window?
ofc we do but in 2nd type of problem it give TLE
@@harshitkumar8988 why should it give tle we are traversing array for only O(n+k)?