![codi](/img/default-banner.jpg)
- 119
- 58 454
codi
India
Приєднався 19 сер 2023
welcome to codi !!
Uncover the art of coding solutions on our channel! 🧠👾 Join us to decode programming puzzles, enhance logical thinking, and level up your coding skills. Let's conquer problems one algorithm at a time! 💻🚀
Uncover the art of coding solutions on our channel! 🧠👾 Join us to decode programming puzzles, enhance logical thinking, and level up your coding skills. Let's conquer problems one algorithm at a time! 💻🚀
Good Substrings || GFG Weekly Contest - 169 || GFG Solution
Good Substrings || GFG Weekly Contest - 169 || GFG Solution
GFG contest solutions today, GFG contest solutions live, GFG solutions, GFG contest 169,GFG Weekly - 169 [Rated Contest], coding, programming, competitive programming, coding tutorials, GFG, GFG editorials , gfg solution
GFG contest solutions today, GFG contest solutions live, GFG solutions, GFG contest 169,GFG Weekly - 169 [Rated Contest], coding, programming, competitive programming, coding tutorials, GFG, GFG editorials , gfg solution
Переглядів: 355
Відео
Minimize Cost || GFG Weekly Contest - 169 || GFG Solution
Переглядів 3414 години тому
Minimize Cost || GFG Weekly Contest - 169 || GFG Solution GFG contest solutions today, GFG contest solutions live, GFG solutions, GFG contest 169,GFG Weekly - 169 [Rated Contest], coding, programming, competitive programming, coding tutorials, GFG, GFG editorials , gfg solution
Count Almost Equal Pairs I || LeetCode Weekly Contest 412 || Leetcode Solution
Переглядів 9134 години тому
Count Almost Equal Pairs I || LeetCode Weekly Contest 412 || Leetcode Solution leetcode weekly contest solutions today, leetcode contest solutions live, leetcode solutions, leetcode contest 412, leetcode weekly contest 412, coding, programming, competitive programming, coding tutorials, leetcode, leetcode editorials
Final Array State After K Multiplication Operations I || LeetCode Weekly Contest 412 || Leetcode Sol
Переглядів 9904 години тому
Final Array State After K Multiplication Operations I || LeetCode Weekly Contest 412 || Leetcode Solution leetcode weekly contest solutions today, leetcode contest solutions live, leetcode solutions, leetcode contest 412, leetcode weekly contest 412, coding, programming, competitive programming, coding tutorials, leetcode, leetcode editorials
Left View of Binary Tree || GFG POTD || August 23/2024
Переглядів 209 годин тому
Left View of Binary Tree || GFG POTD || August 23/2024, gfg , geeksforgeeks , gfg potd , gfg today potd , coding problem , today potd problem solution , gfg problem of the day , gfg potd today solution , gfg potd c , gfg potd java , gfg potd in python
Double Trouble (💢Partially Correct Answer) || CodeChef Starters 148 || CodeChef Solution
Переглядів 1,3 тис.14 годин тому
Double Trouble (*Partially Correct Answer) || CodeChef Starters 148 || CodeChef Solution codechef contest solutions today, codechef contest solutions live, codechef solutions, codechef contest 148,codechef Starters 148, coding, programming, competitive programming, coding tutorials, codechef, codechef editorials, The Undisappearance, FightBots, Let Me Eat Cake!
FightBots || CodeChef Starters 148 || CodeChef Solution
Переглядів 1,9 тис.14 годин тому
FightBots || CodeChef Starters 148 || CodeChef Solution codechef contest solutions today, codechef contest solutions live, codechef solutions, codechef contest 148,codechef Starters 148, coding, programming, competitive programming, coding tutorials, codechef, codechef editorials, Let Me Eat Cake!, The Undisappearance, Double Trouble
Let Me Eat Cake! || CodeChef Starters 148 || CodeChef Solution
Переглядів 1,3 тис.14 годин тому
Let Me Eat Cake! || CodeChef Starters 148 || CodeChef Solution codechef contest solutions today, codechef contest solutions live, codechef solutions, codechef contest 148,codechef Starters 148, coding, programming, competitive programming, coding tutorials, codechef, codechef editorials, The Undisappearance, FightBots, Double Trouble
Minimum Remaining Boys - I || GFG Weekly Contest - 168 || GFG Solution
Переглядів 22621 годину тому
Minimum Remaining Boys - I || GFG Weekly Contest - 168 || GFG Solution GFG contest solutions today, GFG contest solutions live, GFG solutions, GFG contest 168,GFG Weekly - 168 [Rated Contest], coding, programming, competitive programming, coding tutorials, GFG, GFG editorials , gfg solution, Maximum Value, Geekland Tax Calculator
Maximum Value || GFG Weekly Contest - 168 || GFG Solution
Переглядів 20121 годину тому
Maximum Value || GFG Weekly Contest - 168 || GFG Solution GFG contest solutions today, GFG contest solutions live, GFG solutions, GFG contest 168,GFG Weekly - 168 [Rated Contest], coding, programming, competitive programming, coding tutorials, GFG, GFG editorials , gfg solution, Geekland Tax Calculator
Geekland Tax Calculator || GFG Weekly Contest - 168 || GFG Solution
Переглядів 15421 годину тому
Geekland Tax Calculator || GFG Weekly Contest - 168 || GFG Solution GFG contest solutions today, GFG contest solutions live, GFG solutions, GFG contest 168,GFG Weekly - 168 [Rated Contest], coding, programming, competitive programming, coding tutorials, GFG, GFG editorials , gfg solution
Maximum Energy Boost From Two Drinks || LeetCode Weekly Contest 411 || Leetcode Solution
Переглядів 94621 годину тому
Maximum Energy Boost From Two Drinks || LeetCode Weekly Contest 411 || Leetcode Solution leetcode weekly contest solutions today, leetcode contest solutions live, leetcode solutions, leetcode contest 411, leetcode weekly contest 411, coding, programming, competitive programming, coding tutorials, leetcode, leetcode editorials
Count Substrings That Satisfy K-Constraint I || LeetCode Weekly Contest 411 || Leetcode Solution
Переглядів 81021 годину тому
Count Substrings That Satisfy K-Constraint I || LeetCode Weekly Contest 411 || Leetcode Solution leetcode weekly contest solutions today, leetcode contest solutions live, leetcode solutions, leetcode contest 411, leetcode weekly contest 411, coding, programming, competitive programming, coding tutorials, leetcode, leetcode editorials
Find the Power of K-Size Subarrays II || LeetCode Biweekly Contest 137 || Leetcode Solution
Переглядів 896День тому
Find the Power of K-Size Subarrays II || LeetCode Biweekly Contest 137 || Leetcode Solution, leetcode Biweekly contest solutions today, leetcode contest solutions live, leetcode solutions, leetcode contest 137, leetcode Biweekly Contest 137, coding, programming, competitive programming, coding tutorials, leetcode, leetcode editorials , biweekly contest 137, leetcode contest 137
Find the Power of K-Size Subarrays I || LeetCode Biweekly Contest 137 || Leetcode Solution
Переглядів 65День тому
Find the Power of K-Size Subarrays I || LeetCode Biweekly Contest 137 || Leetcode Solution, leetcode Biweekly contest solutions today, leetcode contest solutions live, leetcode solutions, leetcode contest 137, leetcode Biweekly Contest 137, coding, programming, competitive programming, coding tutorials, leetcode, leetcode editorials , biweekly contest 137, leetcode contest 137
Non-Primes 101 || CodeChef Starters 147 || CodeChef Solution
Переглядів 1,7 тис.День тому
Non-Primes 101 || CodeChef Starters 147 || CodeChef Solution
Truth Teller And Liars 101 || CodeChef Starters 147 || CodeChef Solution
Переглядів 941День тому
Truth Teller And Liars 101 || CodeChef Starters 147 || CodeChef Solution
Independence Day 101 || CodeChef Starters 147 || CodeChef Solution
Переглядів 1,2 тис.День тому
Independence Day 101 || CodeChef Starters 147 || CodeChef Solution
Counting Game || GFG Weekly Contest - 167 || GFG Solution
Переглядів 20814 днів тому
Counting Game || GFG Weekly Contest - 167 || GFG Solution
Maximizing Productivity || GFG Weekly Contest - 167 || GFG Solution
Переглядів 22614 днів тому
Maximizing Productivity || GFG Weekly Contest - 167 || GFG Solution
Bit Maximization || GFG Weekly Contest - 167 || GFG Solution
Переглядів 27914 днів тому
Bit Maximization || GFG Weekly Contest - 167 || GFG Solution
Find the Count of Monotonic Pairs I || LeetCode Weekly Contest 408 || Leetcode Solution
Переглядів 60114 днів тому
Find the Count of Monotonic Pairs I || LeetCode Weekly Contest 408 || Leetcode Solution
Count the Number of Good Nodes || LeetCode Weekly Contest 410 || Leetcode Solution
Переглядів 1,1 тис.14 днів тому
Count the Number of Good Nodes || LeetCode Weekly Contest 410 || Leetcode Solution
Snake in Matrix || LeetCode Weekly Contest 410 || Leetcode Solution
Переглядів 55514 днів тому
Snake in Matrix || LeetCode Weekly Contest 410 || Leetcode Solution
Maximize Array Value After Rearrangement || GFG POTD || August 9/2024
Переглядів 19314 днів тому
Maximize Array Value After Rearrangement || GFG POTD || August 9/2024
Bouncing Ball || CodeChef Starters 146 || CodeChef Solution
Переглядів 1,4 тис.14 днів тому
Bouncing Ball || CodeChef Starters 146 || CodeChef Solution
Permutation Construction || CodeChef Starters 146 || CodeChef Solution
Переглядів 1,4 тис.14 днів тому
Permutation Construction || CodeChef Starters 146 || CodeChef Solution
Knockout tournament || CodeChef Starters 146 || CodeChef Solution
Переглядів 2,3 тис.14 днів тому
Knockout tournament || CodeChef Starters 146 || CodeChef Solution
No Winner || CodeChef Starters 146 || CodeChef Solution
Переглядів 2,2 тис.14 днів тому
No Winner || CodeChef Starters 146 || CodeChef Solution
Varient Operations || GFG Weekly - 166 || GFG Solution
Переглядів 16421 день тому
Varient Operations || GFG Weekly - 166 || GFG Solution
Thompson Dorothy Harris Edward Wilson Susan
anyone please share 3 or 4
Remaining 2 questions plzz
long long cntGood(string s) { // code here long long a = 0; int z = 0; for (int i = 0; i < s.size(); i++) { int v = s[i] - '0'; if (v % 2 != 0) { a += i + 1; a -= z; } if (v == 0) z++; } return a; }
long long minCost(int n, vector<int> &a, vector<int> &b) { // code here map<int, int> count; vector<int> swap_a, swap_b; for (int i = 0; i < n; i++) { count[a[i]]++; count[b[i]]--; } for (auto it: count) { if (it.second % 2 != 0) return -1; } for (int i=0; i < n; i++) { if (count[a[i]] > 0) { swap_a.push_back(a[i]); count[a[i]] -= 2; } if (count[b[i]] < 0) { swap_b.push_back(b[i]); count[b[i]] += 2; } } sort(swap_a.begin(), swap_a.end()); sort(swap_b.rbegin(), swap_b.rend()); long long cost = 0; int m = swap_a.size(); for (int i = 0; i < m; i++) { cost += min(swap_a[i], swap_b[i]); } return cost; }
Give the code in comment
class Solution { public: long long minCost(int n, vector<int> &a, vector<int> &b) { map<int, int> count; vector<int> swap_a, swap_b; // Count frequency differences between arrays a and b for (int i = 0; i < n; i++) { count[a[i]]++; count[b[i]]--; } // Check if it's possible to make arrays equal for (auto it : count) { if (it.second % 2 != 0) return -1; } // Collect elements to be swapped for (int i = 0; i < n; i++) { if (count[a[i]] > 0) { swap_a.push_back(a[i]); count[a[i]] -= 2; } if (count[b[i]] < 0) { swap_b.push_back(b[i]); count[b[i]] += 2; } } // Sort swap_a in ascending order and swap_b in descending order sort(swap_a.begin(), swap_a.end()); sort(swap_b.rbegin(), swap_b.rend()); long long cost = 0; int m = swap_a.size(); // Calculate the minimum cost of swapping for (int i = 0; i < m; i++) { cost += min(swap_a[i], swap_b[i]); } return cost; } };
other??
Bhai 2nd bhejo
something is wrong, its not working can anyone help
Bhai python solutions kha milenge ? Anyone knows?
Bhai python solutions kha milenge ? Anyone knows?
Bhai kisi ko pata h python solutions kha milenge ???
is there python solution for this?
3rd question solution please
answers in comment bro plz its not visible
4th answer is also same as 3rd answer
code bhej bhai
comment pe de
code in comment
please upload today gfg weekly contest solutions
Bhai 2nd ya 3rd ya 4th ka answer bhi daal do
code bhej do comment pe
Bhai 3rd ka bhej
share the code in c++
Key Idea of the Problem: - You are given two paths. One leads to eternal happiness, and the other leads to certain doom. - Out of ( N + M ) people, ( N ) people are guaranteed to always tell the truth, and the other ( M ) people may or may not tell the truth (i.e., they can lie). - You need to ensure you can find the correct path by asking ( X ) people (and you don't know in advance who are the truth-tellers or liars). Approach: 1. If ( N <= M ): - If the number of truth-tellers ( N ) is less than or equal to the number of people who may lie ( M ), it's impossible to guarantee the correct path. - This is because the liars may outnumber or equal the truth-tellers, and no matter who you ask, you can't reliably distinguish the truth from the lies. In this case, the output should be `-1`. 2. If ( N > M ): - If the number of truth-tellers ( N ) is greater than the number of potential liars ( M ), it is possible to determine the correct path by asking enough people. - To guarantee finding the correct path, you need to ask enough people such that even if the maximum number of liars ( M ) give false answers, the majority of responses will still indicate the correct path. - The minimum number of people ( X ) you need to ask is ( 2M + 1 ). This is because even if all ( M ) liars lie and disagree with each other, there will still be a majority who are truth-tellers giving consistent answers.
code
code
Can you please explain the logic sir ?
Key Idea of the Problem: - You are given two paths. One leads to eternal happiness, and the other leads to certain doom. - Out of ( N + M ) people, ( N ) people are guaranteed to always tell the truth, and the other ( M ) people may or may not tell the truth (i.e., they can lie). - You need to ensure you can find the correct path by asking ( X ) people (and you don't know in advance who are the truth-tellers or liars). Approach: 1. If ( N <= M ): - If the number of truth-tellers ( N ) is less than or equal to the number of people who may lie ( M ), it's impossible to guarantee the correct path. - This is because the liars may outnumber or equal the truth-tellers, and no matter who you ask, you can't reliably distinguish the truth from the lies. In this case, the output should be `-1`. 2. If ( N > M ): - If the number of truth-tellers ( N ) is greater than the number of potential liars ( M ), it is possible to determine the correct path by asking enough people. - To guarantee finding the correct path, you need to ask enough people such that even if the maximum number of liars ( M ) give false answers, the majority of responses will still indicate the correct path. - The minimum number of people ( X ) you need to ask is ( 2M + 1 ). This is because even if all ( M ) liars lie and disagree with each other, there will still be a majority who are truth-tellers giving consistent answers.
Thanks ❤❤❤ bhaiya
//author: cp_god //date: 14th august 2024 #include<bits/stdc++.h> #define int long long using namespace std; int32_t main(){ int t; cin>>t; while(t--){ int n,m; cin>>n>>m; if(m>=n) cout<<-1<<endl; else{ cout<<m*2+1<<endl; } } } truth tellers code
This showing runtime
Bro please give the source code
Sourcecode please
Send code
4th wala bej do
Send code
bhai improve kaise kare ek bhi question nahi hua mera
can you make a video explaining the solution? ngl this was a pretty goog dp solution
Good, but I am not able to solve any of these
it is completely depends upon your practice. Today you do not solve any problem but you practice it with consistancy, one day you will solve any type of problem 💚
How the other country guysbare doing da they just finished everything in just 25 minutes
3rd Any Idea Bruh?
Check the channel page
the background music is irritating
aree bahi eska solution dedo
Bro please send code in cmt because my code is working correct but showing time limit exceed please share ur code if u can in cmt section
#include <bits/stdc++.h> using namespace std; int main() { int foo; cin >> foo; vector<int> bar; for (int _ = 0; _ < foo; ++_) { int baz; cin >> baz; vector<int> qux(baz); for (int i = 0; i < baz; ++i) { cin >> qux[i]; } vector<int> quux(baz, 0); vector<int> corge(baz, 0); quux[0] = qux[0]; for (int grault = 1; grault < baz; ++grault) { quux[grault] = quux[grault - 1] + qux[grault]; } corge[baz - 1] = qux[baz - 1]; for (int grault = baz - 2; grault >= 0; --grault) { corge[grault] = corge[grault + 1] + qux[grault]; } int waldo = 0; for (int fred = 0; fred < baz; ++fred) { if (qux[fred] == 0) { if (corge[fred] == quux[fred]) { waldo += 2; } else if (abs(corge[fred] - quux[fred]) == 1) { waldo += 1; } } } bar.push_back(waldo); } for (const int& plugh : bar) { cout << plugh << endl; } return 0; }
bahut bahut thanks last 10 min bacche hai bro thanks
Code bhej de bhai
bro code ki link send karo
Code in comment please
bhai code in comment
❤❤❤
bouncing ball
Bro once explain afterwards please
bro send ans