1700. Number of Students Unable to Eat Lunch | Stack & Queue | Simulation | Adhoc | Time Complexity

  Рет қаралды 2,628

Aryan Mittal

Aryan Mittal

Күн бұрын

Пікірлер: 11
@ARYANMITTAL
@ARYANMITTAL 5 ай бұрын
Resume Review Live & Chill stream, next live coming on 500 Subs ❤ - kzbin.infoHqMOVoWas-Q?si=gI-ufL6JtGeE91p2
@codingkart245
@codingkart245 5 ай бұрын
Brute force, but using a bool value to check if there is repeatation: int countStudents(vector& students, vector& sandwiches) { stack st; for(int i = sandwiches.size()-1;i>=0;i--){ st.push(sandwiches[i]); } queue que; for(int i = 0;i
@greynorld1580
@greynorld1580 5 ай бұрын
i had tried it using vector itself and got a runtime of 0 ms int countStudents(vector& students, vector& sandwiches) { int rotations=0; while(rotations
@pavitrasingh7833
@pavitrasingh7833 4 ай бұрын
the first approach for second case is giving 2 as output which is wrong .someone please help me . its working correctly for 1st case .
@mreal_Wakusei
@mreal_Wakusei 5 ай бұрын
i have tried to solve with first approach it doesn't give me desired output: class Solution { public: int countStudents(vector& students, vector& sandwiches) { stackst; //sandwiches stack queueque; //students queue for(int student:students){ que.push(student); } for(int i=st.size()-1; i>=0;i--){ st.push(sandwiches[i]); } int unableToEat=0; while(!que.empty() && !st.empty()){ if(st.top()==que.front()){ que.pop(); st.pop(); unableToEat=0; } else{ que.push(que.front()); que.pop(); unableToEat++; if(unableToEat==que.size()) break; } } return que.size(); } };
@_anteikuu_2400
@_anteikuu_2400 5 ай бұрын
you need to return stack size in the end not queue size
@learningmaths786
@learningmaths786 5 ай бұрын
Very good Aryan keep it up
@ARYANMITTAL
@ARYANMITTAL 5 ай бұрын
Thanks a lot sir, aapke coments dekh kar maja aa jaata hai, learning maths ji is always there ❤️❤️🙏
@user-gm1gn7dm6s
@user-gm1gn7dm6s 5 ай бұрын
First comment
@ARYANMITTAL
@ARYANMITTAL 5 ай бұрын
❤️❤️🥹
950. Reveal Cards In Increasing Order | Queue | Simulation
14:27
Aryan Mittal
Рет қаралды 6 М.
拉了好大一坨#斗罗大陆#唐三小舞#小丑
00:11
超凡蜘蛛
Рет қаралды 16 МЛН
Zombie Boy Saved My Life 💚
00:29
Alan Chikin Chow
Рет қаралды 35 МЛН
Самое неинтересное видео
00:32
Miracle
Рет қаралды 1 МЛН
Number of Students Unable to Eat Lunch - Leetcode 1700 - Python
8:22
678. Valid Parenthesis String | DP | Stacks | 2 Pointers | 3 Ways
38:32
LeetCode was HARD until I Learned these 15 Patterns
13:00
Ashish Pratap Singh
Рет қаралды 257 М.
Dynamic Programming isn't too hard. You just don't know what it is.
22:31
DecodingIntuition
Рет қаралды 129 М.
1249. Minimum Remove to Make Valid Parentheses | Stack | 4 ways
38:59
WHY IS THE STACK SO FAST?
13:46
Core Dumped
Рет қаралды 151 М.
1814. Count Nice Pairs in an Array | Standard Trick
11:12
Aryan Mittal
Рет қаралды 1,7 М.
拉了好大一坨#斗罗大陆#唐三小舞#小丑
00:11
超凡蜘蛛
Рет қаралды 16 МЛН