GeeksForGeeks - POTD | GFG POTD Answer
Yopiq kanal
π© Channel was restricted by Telegram
Ko'proq ko'rsatish1 218
Obunachilar
Ma'lumot yo'q24 soatlar
-97 kunlar
-5730 kunlar
Postlar arxiv
β‘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.
