Live Codechef Starters 133 Discussion | Abhinav Awasthi | coding75 Pro
HTML-код
- Опубликовано: 25 июн 2024
- Subscribe to the channel for Amazing Coding and Competitive Programming Content.
Get all solutions here: coding75.com/dsa-cp/codechef/...
Join Live Class Meet Here: coding75.com/classroom/live/c...
🔥 Subscribe to coding75 Pro for Live Classes, 1:1 Mentorship Sessions: coding75.com/pro
✅ Live DSA Classes
✅ Codeforces, Codechef, Leetcode Live Discussion
✅ 1:1 Mock Interviews
✅ 1:1 Mentorship Sessions
✅ 1:1 Resume Review
✅ Live Weekly Project Building Sessions
✅ Live CS Fundamental Classes
In case of any queries regarding coding75, WhatsApp us here: wa.me/message/TPN76XLWVOWDB1
Or join our updates group: chat.whatsapp.com/KAXRJJUx2lA...
🚀 Join Telegram for Post Contest Discussions, Coding Meets, and Important Updates, Join a Community of over 20,000+ Coders: t.me/cpabhinav
📌 Follow me on Instagram for Regular Updates: / iammabhinav
📌 Join my family of 40K+ on Linkedin: / abhinavawasthi01
📌 Whatsapp Channel: whatsapp.com/channel/0029Va55...
👉🏻 Coding Profiles
My Codeforces: codeforces.com/profile/abhina...
My Codechef: www.codechef.com/users/abhina...
My Leetcode: leetcode.com/abhinavawasthi/
👉🏻 Connect with Me
LinkTree- linktr.ee/abhinavawasthi
My LinkedIn- / abhinavawasthi01
My Instagram- / iammabhinav
My Facebook- / awasthi.abhinav.3
My Twitter- / call_me_abhinav
Coding Blogs- abhinavawasthi.code.blog/
coding
programming
competitive programming
software developer
software engineer
interview preparation
interview experience
dsa
00:00 Introduction
02:22 Devouring Donuts
03:50 Legs on a Farm
08:06 Maximum Alternating Sum
16:08 Powered Parameters
36:48 ABC Conjecture 3
46:48 coding75 Pro
🔥 Subscribe to coding75 Pro for Live Classes, 1:1 Mentorship Sessions: coding75.com/pro
✅ Live DSA Classes
✅ Codeforces, Codechef, Leetcode Live Discussion
✅ 1:1 Mock Interviews
✅ 1:1 Mentorship Sessions
✅ 1:1 Resume Review
✅ Live Weekly Project Building Sessions
✅ Live CS Fundamental Classes
In case of any queries regarding coding75, WhatsApp us here: wa.me/message/TPN76XLWVOWDB1
@AbhinavAwasthi have a look at my approach
int n = s.nextInt() ;
int even_indices = 0 ;
if (n % 2 == 0) even_indices = n/2 ;
else even_indices = n/2 + 1 ;
int arr[] = new int[n] ;
for (int i = 0 ; i < n ; i++) {
arr[i] = s.nextInt() ;
}
int sum = 0 ;
Arrays.sort(arr) ;
for (int i = n - 1 ; i >= 0 ; i--) {
if (even_indices>0) {
sum += arr[i] ;
}
else {
sum -= arr[i] ;
}
even_indices-- ;
}
System.out.println(sum ) ;
who knew that brute force would work in powered parameters so i didn't tried it lol
bhaiya pls cc ke aur contest ke bhi discussion kia kro na...
Live discussion will be here: coding75.com/classroom
bhaiya proof wgera to dia ni ABC conjecture ka ? What was the intution of such solution ?
Thanks for Powered Parameters time complexity explanation!!!
Welcome
Thank you for making such informative videos!
Thanks
Very Nice explanation thanku bhaiya
Great explanation sir❤️🎉
sir,in worst case it will be run for 30 times so the time complexity should be O(30*N) eventualy O(N), but you said O(logn) where do i mistaken.. because take {2,2,2,2,2,2........,(2*10^5)-1 time and,10^9} so in this case every 2 take 30 time ,
Yeah it is O(30*N).
string ans =s;
cta=0;
ctb=0;
ctc=0;
int buffer=0;
int fans=0;
int cc=0;
int ca=0;
for(int i=0;i
Question d❤
Thanks
sir why this solution for ABC conjecture 3 is not right
int a = 0;
int b = 0;
long long ans = 0;
for(int i =0;i0){
b++;
}else if(s[i] == 'c'){
if(a>0 && b>0){
ans++;
a--;
}
}
}
cout
You are not handling cases where b is before a, you are just checking that a and b both are there
like i want to ask what is the use of ca why we are not using a directly
@@AbhinavAwasthi sir im checking in else if im checking if s[i] == 'b' and if a is greater than 1 than only im updating it
You can join telegram for better discussion
@@AbhinavAwasthi okay sir and yes i understood it like after finding one b we can't take a after that b but I'm taking it like if we have something like abaac in this we can make only one ABC but I will count 3 a and b is also 1 so we will make 3 but its is not correct. thank you sir
Too good 😊😊❤
#include
using namespace std;
void solve()
{
int n;
cin >> n;
vector v(n);
for (auto &x : v)
cin >> x;
long long int maxi = *max_element(v.begin(), v.end());
long long count = 0;
for (int i = 0; i < n; i++)
{
if (v[i] == 1)
{
count += n;
}
}
for(int i=0;i
It is because of overflow.
In the case of 2 , 2^31 ~ 1e9 but if you take 7^31 it overflows as 7^31 is very large due to which wrong value gets stored in your val variable. You can just add an if condition to check if val is greater than 1e9 , if it is you can just break the loop.
take continue for case v[i]==1 it will work
@@ritvikreddy3959 thanku bhai 🙏
@@singhshivam6730 thanku bhai 🙏