Taking an array from the user would mean using variable size for the array. If you guys are not using vs code or codeblock you will see an error where the comipiler is asking for a constant instead of n. So instead of using : int n; cin>>n; int arr[n]; for(int i=0; i>arr[i]; Use : int n; cin>>n; int *arr = new int[n]; for(int i=0; i>arr[i];
Bhai ye tera suggestion mai actually mai koi sense nahi banta bcoz bhaiya ki team mai 7 to 8 members hai aur doubts puch wale students thousands ya lakhs mai hai
for those who are using Microsoft Visual and getting input array size error. you have to initiate dynamic array instead of static array. #include #include using namespace std; int main() { int n; cout > n; int *arr{ new int[n] }; for (int i=0; i < n; i++) { cin >> arr[i]; } for (int i=0; i < n; i++) { cout
I'm the first viewer💪🏻🔥... Bhaiya aapne aag lga rkhi hai...!!🔥 And thanks di aap bhott acha explain karte hoo🔥🔥💪🏻 thank you so much other team members 💪🏻🔥❤️
*Answer* of practice question 2 i.e. GIVEN IN THE NOTES #include using namespace std; int main() { int kids,i, maximum=0; coutkids; string NameOfKids[kids]; int CandyOfKids[kids]; cout
Practice Question 2 : kid with the greatest no. of candies........(assuming the kid numbering starts from 1) #include using namespace std; //kid with max number of candies int maxcandy(int demoarray[], int n){ int maxi=demoarray[0]; for(int i=0; i
#include using namespace std; int main (){ int a ; int sun = 0; cin >> a; int array[a]; for(int i = 0; i < a ; i++){ cin >> array[i] ; } for(int n = 0; n < a ; n++){ sun += array[n]; } cout
9:48 Instead of assigning INT_MIN to maxNo and INT_MAX to minNo, We should assign arr[0] to both of them as we are comparing the elements of array only
thanks a lot as compared to two bhaiya in previous 2 videos you're far better then those bhaiya and explain the concept very easily they may be good programmers but teaching to others is a different thing and i think you're pretty good on it.
********ANSWER FOR SUM OF AN ARRAY QUESTION ********** #include using namespace std; int main() { int n; cin>>n; int arr[n]; for(int i=0;i>arr[i]; } int sum=0; for(int i=0;i
very helpful videom thank u for the hard work for us, which is helping me and lakhs of students. very fortunate to recieve videos for no price. i would like to contribute back to apna college
the explanations seem a little rushed, Like the reasons for doing certain steps are not explained clearly which makes it hard for beginners like me to understand. other than that I Love this series, it has helped me so much!!! thank you!
Some people may experience runtime error as it may not accept the user input size (n) for an array. In that case, kindly add additional 2 lines of codes after int main() function as mentioned bellow - #include using namespace std; int main() { const int size = 100; // this allocates a memory. the user can choose a size less than 100 in this case. int array[size]; int n; cin >> n; for (int i = 0; i < n; i++) { cin >> array[i]; } for (int i = 0; i < n; i++) { cout
@@codeWith.Sam_ Vector and macros are used for this program. As I am new here so I left this one till I complete the videos related to those concepts. But if you want some solutions of this program with different approaches than this link might help you. leetcode.com/problems/kids-with-the-greatest-number-of-candies/discuss/
when we take maxNo=INT_MIN, we are assigning the variable maxNo with the lowest possible value in c++. So now, any value from the array will be greater than this value, and will simply get assigned first. So maxNo will never be equal to INT_MIN. And for each element in the array, we are going to check if it is greater than the current maxNO value or not, and if it is, maxNo then gets updated.
Bro the logic behind it is.. int maxNo = INT_MIN int minNo = INT_MAX You know na, there is a inbuilt function max and min. so maxNo = max(arr[i],maxNo) . Here arr[i] should be greatest. and in int maxNo ,the number to be stored should be the smallest . So int_min is stored in maxNo because its the min . So if we compare max(arr[i],maxNo), here maxNo is smaller than arr[i].. and max function finds the greatest number bewteen this. arr[i] > maxNO; So arr[i] is printed in max .. Similarly reverse it in min function. You will get the answer. Just sit for 2mins and think it logically. hope it is useful.
@@Biliphang088 bhai tera 2nd para dekh wo bas if statement ko khatam karne ke lie h to uska isse koi logic nahi h. #important for all Sunna dd ne kya bola h, int_min aur int_max ke bare me (jab wo if statement likhi thi) maximum pane ke lie agar int_min agar kisi se choto hoga to wah update hoga(read again) mtlb wo aage badh jaega or aage chek karega min se max jane ke lie usi tarah iska ulta dekh sab samjh me aajaega
I put on lofi music while listening to the lectures. It increased the attention level here. Guys, I suggest you try experimenting with it and if you see any promising results, then, sure enough, you can license and put that music in the videos. In future videos.
// we can initialize min and max with the first element and start the loop from 1 (current me if I am wrong here, thanks in advance) private static void mainAndMaxInArray(int[] arr) { int min = arr[0], max = arr[0]; for (int i = 1; i < arr.length; i++) { if (min > arr[i]) { min = arr[i]; }else if(max < arr[i]){ max = arr[i]; } } System.out.println(max +"::::"+ min); }
MY APROACH FOR MIN MAX PROBLEM: int main(){ int n, min, max; cout> n; int ages[n]; for (int i = 0; i < n; i++){ cin>> ages[i]; } min = ages[0]; max = ages[0]; for (int i = 1; i < n; i++){ if(max < ages[i]){ max = ages[i]; } else{ if (min > ages[i]){ min = ages[i]; } } } cout
Thank you. edit : bas ek chota sa doubt tha.....maine jab C programming mai array declare karna seekha tha to usme hame pehle hi array size batani padti thi, so is this a new feature that C++ has in which we can get the size of the array from the user during runtime without using malloc and stuff?
Awesome lecture!! The practice questions link isn't opening. please see. And also in the notes, lec 7.1 is titled as 8.1 and now 8.1 is titled as 9.1 thanks again @Apna College
Isn't that a bad practice to initialize Static Arrays with a variable(like 'n' in this case) because Static arrays have to be initialized with a Constant Value? Clang and MingW may allow u to do that but if you try to do this on Microsoft Visual C++ that will throw a Compilation Error and Program Crashes. The Error is stated as: *expression must have a constant value -- the value of variable "n" (declared at line 5) cannot be used as a constantC/C++(28)*
I like the confidence she has when she deliver the lectures..
Taking an array from the user would mean using variable size for the array.
If you guys are not using vs code or codeblock you will see an error where the comipiler is asking for a constant instead of n.
So instead of using :
int n;
cin>>n;
int arr[n];
for(int i=0; i>arr[i];
Use :
int n;
cin>>n;
int *arr = new int[n];
for(int i=0; i>arr[i];
Thank goodness, someone else has encountered the same issue. 😅
Conclusion: Rahul is a player
No, I am not🙄
sunn meri baat, it's his choice!!😂😂
@@rahull9155 You are impostor
@@tech_wizard9315 rahul looks sus
Are😆😆😆😂😂😂😂😂
Finally didi is back again 🥰🥰
Bhaiya after reading this comment : Soka?
Simp
@@vinayakmate693 oh i almost forgot that I used to watch this course 😅😅
Not a simp though 😂
@@aryansharma-wf8sn wait does that mean this is not worth remembering or what?
@@hrithikpandey1482 no no it is a really great course, but I just got busy in some other stuff lately so I stopped watching it
bhaiya ek suggestion hai.
Har week ke end me ek doubt session related to this course livestream kar dijiye.
jisko jisko ye chahiye like karo.
tu rk kaam kar free me bhai ki jaydad bhi maangle
@@otm_empire mtlb koi ab kuch suggests bhi na kare?
Bhai ye tera suggestion mai actually mai koi sense nahi banta bcoz bhaiya ki team mai 7 to 8 members hai aur doubts puch wale students thousands ya lakhs mai hai
@kapil 9999 🤝🏻theek hai bhai
glti ho gayi mafi patr likh deta hu unko
for those who are using Microsoft Visual and getting input array size error. you have to initiate dynamic array instead of static array.
#include
#include
using namespace std;
int main()
{
int n;
cout > n;
int *arr{ new int[n] };
for (int i=0; i < n; i++)
{
cin >> arr[i];
}
for (int i=0; i < n; i++)
{
cout
visual studio code se acha online compiler use krlo. itna janjhat he isme
thanq bro i was getting the same error
@@thewhitene9746 chup be chuu
@@thewhitene9746 apni dream company me jaa kar bhi online compiler use kario
@@thewhitene9746 Vs code is not a compiler and you can create your own user snippets using json for different programming language
Urvi Mam is lub❤️.
Aap hi pdhte rho🙏
When I play video and lesten the voice i be like : कहां थे आप ....😂❤️🔥👍🏻
Are bhai bhai
pucha kisi ne?
@@AbhinavKumar-ri8zi kuch baatein puchi nhi jati *laxman 😁👍🏻
nakkliiiii
ua-cam.com/video/5FsIa4Mp3ho/v-deo.html🙏🏻🙏🏻🙏🏻
Amazing c++ course
Every one have to watch and learn this course 👍👍👍👍👍
jindagi k maze to rahul le rha h... hm to bs coding sikhte hi rah jaenge🥲
Girls in thumbnail and examples with girlfriends always does the work for boys.....🤣🤣🤣🤣🤣🤣🤣.
BTW great work didi....lots of love and respect for ya.
maine to video's aage karke dekhe kaha aane vali hai didi...finally aa gayi ,sukun mila
she expains beautifully , i cant stop watching her video
Aap hi sab video kijiye aapki aawaz dimaag ke saath saath dil ma bhi utar jaati ha ♥️
Today I got to understand what really ARRAY is??? Thankyou APNA COLLEGE.
result :: after preparing c++ from this series You may become rahul
I wish
kuch ni banega tu
😂
I become Neha's fan
ua-cam.com/video/5FsIa4Mp3ho/v-deo.html🙏🏻🙏🏻
I'm the first viewer💪🏻🔥... Bhaiya aapne aag lga rkhi hai...!!🔥 And thanks di aap bhott acha explain karte hoo🔥🔥💪🏻 thank you so much other team members 💪🏻🔥❤️
*Answer* of practice question 2 i.e. GIVEN IN THE NOTES
#include
using namespace std;
int main() {
int kids,i, maximum=0;
coutkids;
string NameOfKids[kids];
int CandyOfKids[kids];
cout
Where is the Problem statement?
"...aur usme daal do uske.. age !!"😂
(0.10 to 0.13 sec)
BTW Thank you so much for this type of consistency. Carry on. ❤
ua-cam.com/channels/bFwBZLhHZEhhXy0nNCKlKg.html
Bahot tezz ho rhe ho 😜😜
@@sachinrastogi4691 nice share 🙃
Bade ha** mi ho beta😂
ua-cam.com/video/5FsIa4Mp3ho/v-deo.html🙏🏻🙏🏻
Practice Question 2 : kid with the greatest no. of candies........(assuming the kid numbering starts from 1)
#include
using namespace std;
//kid with max number of candies
int maxcandy(int demoarray[], int n){
int maxi=demoarray[0];
for(int i=0; i
Thank you for this amazing series. I am from Electrical background interested in CS/IT and this playlist helped me a lot
EEE OR EE
From which college. I am also an electrical engineering student
//RUNNING SUM OF AN ARRAY
#include
using namespace std;
int main()
{
int n;
coutn;
coutnums[i];
}
cout
thanks a lot for this quality of course .
god bless you and all the team.
#include
using namespace std;
int main (){
int a ;
int sun = 0;
cin >> a;
int array[a];
for(int i = 0; i < a ; i++){
cin >> array[i] ;
}
for(int n = 0; n < a ; n++){
sun += array[n];
}
cout
Rahul is so lucky.
He have too many girlfriends.
Neha didn't came in this video otherwise she come in every video.
Didi try to take Neha in next video.
Just joking ok.
Lol
Has*
@@_rahulsain rahul spotted
Oh bhai maro muje maro
Your teaching style is best plus your voice
Thank you Apna college team... for such a great work... 😊😊❤️
great work Aman Dhattarwal .after all he is paying the faculty from his own pocket.......imparting free education to all
We appreciate your efforts, thanks u so much
*Answer* of practice question 1 i.e. GIVEN IN THE NOTES
#include
using namespace std;
int main() {
int n;
coutn;
cout
9:48
Instead of assigning INT_MIN to maxNo and INT_MAX to minNo, We should assign arr[0] to both of them as we are comparing the elements of array only
I can't understand the logic of Int min and Max can u please explain in English
Mene dono logic se bana liya😅😅
Maaza aa gya.
Dumdaar khiladi meh Array ka definition yaad aa gya😂😂.
Consistency 🔥🔥🔥🔥
best teacher for c++,please jaldi se video daliyo
thanks a lot
as compared to two bhaiya in previous 2 videos you're far better then those bhaiya and explain the concept very easily
they may be good programmers but teaching to others is a different thing and i think you're pretty good on it.
😅
the two of the teachers before this video ohhh my god they are annoying thank god you came back...
Thank you so much Dii❤️ Ur way of explaintion is really great ❤️
Love ❤️day ☀️ assi 8️⃣0️⃣ hazaa 💸💸ke🙈🤘🏻shoes 👟👟🔥hai😘💔asssi✌🏻hazaar💲🤑💰ke😥🤲🏻teraa😭👀ghar🏠🏡jaayenga🤣😹ismee😜🏃🏻♀️tera 👈🏻ghar😙😂isme😜🤣chale🏃🏻♀️🤙🏻jaayennga😡👌🏻👈🏻poora🤯🙌🏻shoesss👟👟dekhh👀🤲🏻
YOU INDIAN GUYS ARE MUCH MORE BETTER THEN MY UNI TEACHERS
Ye rahul ko milna hai muze ek bar zindagi me😂
Aur ye baki gfs ka bhi btana padega neha ko😂😂
@Rahul Sharma 😂 mil jaegi bhai
********ANSWER FOR SUM OF AN ARRAY QUESTION **********
#include
using namespace std;
int main()
{
int n;
cin>>n;
int arr[n];
for(int i=0;i>arr[i];
}
int sum=0;
for(int i=0;i
finally did is back........................
i like the way of teaching of didi, just i feel like my real didi is teaching me
Simp
ua-cam.com/video/5FsIa4Mp3ho/v-deo.html🙏🏻🙏🏻🙏🏻
Thank u bhaia and mam ur explanation is of next level with best example it make easy to understand 😃❤🖤
Thank You So Much Apna College for this amazing lecture 😊
In love with girls voice ❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️
Damn...!!!!! This Rahul fella is some real thing...
Disclaimer: Rahul was not harmed in making this video
very helpful videom thank u for the hard work for us, which is helping me and lakhs of students. very fortunate to recieve videos for no price. i would like to contribute back to apna college
I think we should never ask age from girls 😂😂😂
Best comment
Right,Yes🤣🤣
thats why its an array because they never tell actual age to anyone .
🤣🤣🤣🤣😁😁😁
ua-cam.com/video/5FsIa4Mp3ho/v-deo.html🙏🏻🙏🏻🙏🏻
We can give maxno=array[0] and minno=array[0] ans then
For(int i=1, i
the explanations seem a little rushed, Like the reasons for doing certain steps are not explained clearly which makes it hard for beginners like me to understand. other than that I Love this series, it has helped me so much!!! thank you!
Upto which video should i watch if my motive is to learn only the essentials of ds algo...not competitive Programing??..
@@basabsaha6370 cp ke lectures to abhi upload hi nahi hue and mujhe nahi lagta ki aage kabhi upload honge
didi best ... GOAT .. good of all time teacher
0:16 Rahul is very lucky😁😁😁😁😁😁😁
Playboy h saala🤣🤣
Aman bhaiya bohot bigaad gye hai
Aur baccho ko bhi bigaad rhe hai
lode par hai
Moj krdi Rahul bhaiya aapne to😂😂
Didi ur explaination level is great
thanks that u come again in this playlist
Some people may experience runtime error as it may not accept the user input size (n) for an array. In that case, kindly add additional 2 lines of codes after int main() function as mentioned bellow -
#include
using namespace std;
int main() {
const int size = 100; // this allocates a memory. the user can choose a size less than 100 in this case.
int array[size];
int n;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> array[i];
}
for (int i = 0; i < n; i++) {
cout
@@codeWith.Sam_ Vector and macros are used for this program. As I am new here so I left this one till I complete the videos related to those concepts. But if you want some solutions of this program with different approaches than this link might help you.
leetcode.com/problems/kids-with-the-greatest-number-of-candies/discuss/
Thanks Bhaiya... and Please upload the notes of Time Complexity
Bhot pyara pdhate ho yaar aaap
I would love to volunteer to make captions for these great videos jo pan India ke liye helpful hoga so please switch it on
I am falling in love with your lovely voice
And it's going to become my enthusiasm to learn c++
Rahul name is wrong , it should be ranbir Kapoor😂😂😅😅
thank you bhaiya and didi(speaker).
much much love to both of you.
Rahul Be like My name is Rahul.....aka Womanizer 🤣🤦♀️
Finally urvi di is back
Isn't array memory allocated at compile time? How's your array getting created based on user input?
well you got a point
@@mumairnoor2398 Its dynamic allocation
Generally when we do not know what *will* be the size of array we use dynamic allocation
@@shreyashjoshi8489 well i fid almost the same
but when runing the code it just kept on stop working as my code was crashed
Bhia ek suggestions in video ke sath thode questions bhi add kar dia karo video discription mei practice karne ke liye👍
After this, I think Rahul is the reason why most of us are Single 😂😒
pdhai pr dhyan de tu
@@CleanDevelopYee jo tu kar raha haina usko timepass bolte hai tu jaake kar padhai
Nice ma'am 😊😊 very useful videos
Efforts appreciated ❤❤
Bhot tagda content hai bhaiya ji 🙏🎉🔥
Nice video !! But the practice questions given in the notes are not clickable. So, please look into that.
Okay
Yes you are right
@@ApnaCollegeOfficial now also I am unable to access the questions
Link of given questions is not accessible till now plz once check it @Apna college
Yaa! Just Google the lines given in the PDF in blue colour. You'll get the questions of LEET Code.
I like the way you teach us.
When U R Rahul , & U R SINGLE 🥺🥺🥺🥺
WATCHING THIS VIDEO WILL BE A TRAUMA FOR U
🥺🥺😂😂
Really bro..😥😥
😔
YRVI MAAM IS BACK .....NOW IT WILL BE FUN
please explain i cant understand why we have taken maxNo=INT_MIN
and minNo=INT_MAX
when we take maxNo=INT_MIN, we are assigning the variable maxNo with the lowest possible value in c++. So now, any value from the array will be greater than this value, and will simply get assigned first. So maxNo will never be equal to INT_MIN. And for each element in the array, we are going to check if it is greater than the current maxNO value or not, and if it is, maxNo then gets updated.
@@sharansasikumar5127 bhai he's talking about the logic behind assigning int Minno=INT_MAX.
bhai intialise both of em with zero. and age jaake toh seekh hi jayenge insa b ke logic
Bro the logic behind it is..
int maxNo = INT_MIN
int minNo = INT_MAX
You know na, there is a inbuilt function max and min.
so maxNo = max(arr[i],maxNo) . Here arr[i] should be greatest.
and in int maxNo ,the number to be stored should be the smallest .
So int_min is stored in maxNo because its the min .
So if we compare max(arr[i],maxNo), here maxNo is smaller than arr[i]..
and max function finds the greatest number bewteen this.
arr[i] > maxNO;
So arr[i] is printed in max ..
Similarly reverse it in min function. You will get the answer.
Just sit for 2mins and think it logically.
hope it is useful.
@@Biliphang088 bhai tera 2nd para dekh wo bas if statement ko khatam karne ke lie h to uska isse koi logic nahi h.
#important for all
Sunna dd ne kya bola h, int_min aur int_max ke bare me (jab wo if statement likhi thi) maximum pane ke lie agar int_min agar kisi se choto hoga to wah update hoga(read again) mtlb wo aage badh jaega or aage chek karega min se max jane ke lie usi tarah iska ulta dekh sab samjh me aajaega
I put on lofi music while listening to the lectures. It increased the attention level here. Guys, I suggest you try experimenting with it and if you see any promising results, then, sure enough, you can license and put that music in the videos. In future videos.
Perfectly explained
Mam your voice is so sweet ❤️
// we can initialize min and max with the first element and start the loop from 1 (current me if I am wrong here, thanks in advance)
private static void mainAndMaxInArray(int[] arr) {
int min = arr[0], max = arr[0];
for (int i = 1; i < arr.length; i++) {
if (min > arr[i]) {
min = arr[i];
}else if(max < arr[i]){
max = arr[i];
}
}
System.out.println(max +"::::"+ min);
}
Aare bhai Rahul tum to bade heavy driver nikle yaar 😂😂😂
URVI didi ❤️❤️🔥🔥
so in the practice question 2 , do we need to find the max number of candies among the entered candies or the kid with the max candies
i think they are talking about the kid with the max number of candies.......anyway do them both.......
Yeh lecture mai puri feel aa gyi 💯⚡
MY APROACH FOR MIN MAX PROBLEM:
int main(){
int n, min, max;
cout> n;
int ages[n];
for (int i = 0; i < n; i++){
cin>> ages[i];
}
min = ages[0];
max = ages[0];
for (int i = 1; i < n; i++){
if(max < ages[i]){
max = ages[i];
}
else{
if (min > ages[i]){
min = ages[i];
}
}
}
cout
you could've made a function for finding the max and the min value
🥰
well there is already min() and max () function so that's also not needed.
Aisa Rahul jaisa banda ham sabke group me hota hi he😂
Thank you.
edit : bas ek chota sa doubt tha.....maine jab C programming mai array declare karna seekha tha to usme hame pehle hi array size batani padti thi, so is this a new feature that C++ has in which we can get the size of the array from the user during runtime without using malloc and stuff?
no you can use that in C language also
▶️▶️▶️ There is no course like this one on UA-cam. ▶️▶️▶️
6:28 Fir Arnub chacha bolenge mujhe drugs de 🌚🦆
Rahul ka bahaut sahi hai!
Rahul : Naam to suna hoga he he he😂
Aman bhaiya....Outer cover me KPOP pose😁
Rahul ke girlfriends 🤣🤣🤣🤣
thank you mam .you are good teacher for guide c++...
Yes 💟🥰🤣😆😂🥰🤣🥰💟
Thumbnail mai Aman bhaiya 3 girls ko aankh maar rahe hai😁😁
Le every Rahul watching the video: JALWA HAI HAMARA YAHAN!!😎
Awesome lecture!!
The practice questions link isn't opening. please see.
And also in the notes, lec 7.1 is titled as 8.1 and now 8.1 is titled as 9.1
thanks again @Apna College
Web development ka course kab aayega
😁
10to 15days
@ROHIT RANA tere na sochne se kya hota h bhai🤣🤣
Go Thapa technical chhanel
ua-cam.com/video/5FsIa4Mp3ho/v-deo.html🙏🏻🙏🏻🙏🏻
last question solution without using any other header file.....
#include
int main() {
int n;
scanf("%d",&n);
int array[n];
for(int i=0;i
This is c
Isn't that a bad practice to initialize Static Arrays with a variable(like 'n' in this case) because Static arrays have to be initialized with a Constant Value? Clang and MingW may allow u to do that but if you try to do this on Microsoft Visual C++ that will throw a Compilation Error and Program Crashes.
The Error is stated as:
*expression must have a constant value -- the value of variable "n" (declared at line 5) cannot be used as a constantC/C++(28)*
Lmfao,I'm getting the same issue
Dynamic Arrays is solution to initialize an Array with the Size that user inputs.
@@shahnoorraza8514 yep
@@shahnoorraza8514 Thanks bro
@@adityab1277 Welcome
Broooooii🥹 tuji great ho tofa kubul karo❤️
The reason most of us are single: Rahul xD