GeeksForGeeks - POTD | GFG POTD Answer
کانال بسته
1 218
مشترکین
اطلاعاتی وجود ندارد24 ساعت
-97 روز
-5730 روز
آرشیو پست ها
⚡5paisa ₹300 Reward⚡
1. Go To Link 🔗₹300
2. Open FREE 5paisa Account
3. Get ₹300 Cash Reward.
⚡Refer To Earn More Rewards⚡
⚡Go To refer.5paisa.com To Check Your Total Amount.
⚡My Laptop Full Review⚡
Acer Aspire 7
🔰12th Gen
🔰I5 12450H
🔰RTX 2050
https://youtu.be/D-EzAzrBRls
16th November : C++ Solution ☝🏼
—————————————————————
🙋🏻♂️Discussion ⁉️
Join ✅ @GFG_Answer
⚡ My laptop Review ⚡
class Solution
{
public:
void dfs(int k , string prev , unordered_set &seen , vector &edges){
for(int i=0 ; i seen;
string startingNode = string(n-1,'0');
vector edges;
dfs(k,startingNode,seen,edges);
string ret;
int l = pow(k,n);
for(int i=0 ; i< l ; i++){
ret+=(edges[i]+'0');
}
ret+=startingNode;
return ret;
}
};
15th November : C++ Solution ☝🏼
—————————————————————
🙋🏻♂️Discussion ⁉️
Join ✅ @GFG_Answer
class Solution {
private:
int F(string S){
int a[26] = {};
for(char c : S) a[c - 'a'] = accumulate(begin(a),end(a),1);
return accumulate(begin(a),end(a),0);
}
public:
string betterString(string s1, string s2){
int cnt1 = F(s1) , cnt2 = F(s2);
if(cnt1 == cnt2) return s1;
return cnt1 > cnt2 ? s1 : s2;
}
};
14th November : C++ Solution ☝🏼
—————————————————————
🙋🏻♂️Discussion ⁉️
Join ✅ @GFG_Answer
class Solution
{
public:
//Function to check if two strings are rotations of each other or not.
bool areRotations(string s1,string s2)
{
return (s2+s2).find(s1)!=string::npos;
}
};
13th November : C++ Solution ☝🏼
—————————————————————
🙋🏻♂️Discussion ⁉️
Join ✅ @GFG_Answer
class Solution
{
public:
//Function to find length of shortest common supersequence of two strings.
int shortestCommonSupersequence(string X, string Y, int m, int n)
{
vector dp(n+1) ;
for(int i=0;i<=n;i++)
dp[i] = i ;
int prev = 0 ;
for(int i=1;i<=m;i++)
{
for(int j=0;j<=n;j++)
{
if(j==0)
{
prev = dp[j] ;
dp[j] = dp[j]+1;
continue;
}
int cur = dp[j] ;
if(X[i-1] == Y[j-1])
dp[j] = min(1+prev,1+min(dp[j-1],dp[j])) ;
else
dp[j] = 1+min(dp[j-1],dp[j]) ;
prev = cur ;
}
}
return dp[n] ;
}
};
12th November : C++ Solution ☝🏼
—————————————————————
🙋🏻♂️Discussion ⁉️
Join ✅ @GFG_Answer
class Solution
{
public:
//Function to check if a string can be obtained by rotating
//another string by exactly 2 places.
bool isRotated(string str1, string str2)
{
int n1=str1.size();
int n2=str2.size();
if(n1!=n2)
return false;
int ans1=true,ans2=true;
for(int i=0;i
11th November : C++ Solution ☝🏼
—————————————————————
🙋🏻♂️Discussion ⁉️
Join ✅ @GFG_Answer
class Solution
{
public:
//Function to check if two strings are isomorphic.
bool areIsomorphic(string str1, string str2)
{
if(str1.length() != str2.length()){
return false;
}
map mp;
vector arr(256,false);
for(int i=0;i
10th November : C++ Solution ☝🏼
—————————————————————
🙋🏻♂️Discussion ⁉️
Join ✅ @GFG_Answer
class Solution{
public:
string printMinNumberForPattern(string S){
int n = S.size();
string ans = "";
for(int i=1; i<=n+1; i++)
ans += to_string(i);
for(int i=0; i
9th November : C++ Solution ☝🏼
—————————————————————
🙋🏻♂️Discussion ⁉️
Join ✅ @GFG_Answer
class Solution{
public:
/*Function to count zeros in each column
* N : Number of rows and columns in array
M is the matrix that is globally declared
*/
int columnWithMaxZeros(vector>arr,int n){
int prev_clmn_cnt=n,ans = -1;
for(int j = 0 ; j
⚡Want To Get ₹100 Cash FREE⚡
1. Install App From PLAY STORE
⭐ ( TAP THIS LINK ) ⭐
2. Buy Digital Gold For ₹1 Rupees.
3. Verify With PAN Number.
4. Get Cashback Of ₹100 Rupees Instantly To Your Bank Account.
