GeeksForGeeks - POTD | GFG POTD Answer
Закрытый канал
1 218
Подписчики
Нет данных24 часа
-97 дней
-5730 день
Архив постов
🙋🏻♂️Let's Celebrate🎉 With Some -
🔸👉🏼⚡ NEW COURSES ⚡👈🏼🔸
⚡Which One To Upload First ⁉️
Woohoo‼️🎊
It's FIVE ZERO ZERO😍⚡
Today, We Crossed 500+ Subs❤✨
🔰 Thank You All 500❤ 🔰
‼️Those Who Only Collect GeekBits‼️
Go To This Link - WEEKLY
And Paste This Answer ⬇️⬇️
👉🏼⚡ ANSWER CODE 2 ⚡👈🏼
👉🏼 On 2nd Question 👈🏼
⚡Q. Find Bots on Geeklandster⚡
⭐Course 👉🏼 DOT WEB DEV 💻
‼️Complete 100 Subscribers‼️
⚡ Then You Can Forward ⚡
👉🏼 @GeeksForGeeks_POTD
Share To Your Friends For More Courses Like This ✨
8th October : C++ Solution ☝🏼
—————————————————————
🙋🏻♂️Discussion ⁉️
Join ✅ @GFG_Answer
class Solution{
public:
// Should return head of the modified linked list
Node *sortedInsert(struct Node* head, int data) {
Node* curr = head;
Node* prev = NULL;
Node* newNode = new Node(data);
while(curr != NULL){
if(curr->data <= data){
prev = curr;
curr = curr->next;
}
else {
if(prev == NULL){
newNode->next = curr;
head = newNode;
} else{
newNode->next = prev->next;
prev->next = newNode;
}
break;
}
}
if(prev != NULL && prev->next == NULL){
prev->next = newNode;
}
return head;
}
};
‼️ Dot Web Dev Course ‼️
⚡Forwarding Option On Chaiye ⁉️
7th October : C++ Solution ☝🏼
—————————————————————
🙋🏻♂️Discussion ⁉️
Join ✅ @GFG_Answer
class Solution
{
public:
Node* pairWiseSwap(struct Node* head)
{
if(!head || !head->next) return head;
Node*temp=head->next;
head->next=pairWiseSwap(head->next->next);
temp->next=head;
return temp;
}
};
6th October : C++ Solution ☝🏼
—————————————————————
🙋🏻♂️Discussion ⁉️
Join ✅ @GFG_Answer
class Solution
{
public:
void rearrange(struct Node *odd)
{
if(odd -> next == NULL || odd -> next -> next == NULL) return;
Node *oddd = odd;
Node *next_odd = odd -> next -> next;
Node *even = odd -> next;
Node *prev_even = NULL;
while(1)
{
even -> next = prev_even;
prev_even = even;
if(next_odd == NULL) break;
even = next_odd -> next;
oddd -> next = next_odd;
oddd = next_odd;
if(even == NULL)
{
oddd -> next = prev_even;
break;
}
next_odd = next_odd -> next -> next;
}
}
};
⚡We Are About to Complete 500 Members On This Channel⚡
But,
➡️ Our Discussion Group Has Less Than 200 Members Only.
Join Now 👉🏼 @GFG_Answer ✨
⭐Course 👉🏼 DOT WEB DEV 💻
👉🏼@GeeksForGeeks_POTD
Share To Your Friends For More Courses Like This ✨
‼️Forward Or Save This Text‼️
This Will Be Deleted On 15th October
What Will Be Best Time To Upload Dot Web Dev Course Link ⁉️
JOIN HERE @GeeksForGeeks_POTD
5th October : C++ Solution ☝🏼
—————————————————————
🙋🏻♂️Discussion ⁉️
Join ✅ @GFG_Answer
⚡Visit Once Daily To Get FREE Codedamn T-Shirt 👕 —
https://codedamn.com/referred-by/4f24l
class Solution
{
public:
long long int solve(string s, int k)
{
int n = s.size();
int freq[26] = {0};
int dist_cnt = 0;
long long int ans = 0; //ans count
int i=0; //start of window
int j=0; //end of window
while(j k)
{
freq[s[i]-'a']--;
if(freq[s[i]-'a'] == 0)
dist_cnt--;
i++;
}
j++;
ans += (j-i+1);
}
return ans;
}
long long int substrCount(string s, int k)
{
long long int ans = solve(s,k) - solve(s,k-1);
return ans;
}
};
4th October : C++ Solution ☝🏼
—————————————————————
🙋🏻♂️Discussion ⁉️
Join ✅ @GFG_Answer
⚡Visit Once Daily To Get FREE Codedamn T-Shirt 👕 —
https://codedamn.com/referred-by/4f24l
class Solution {
public:
int romanToDecimal(string &str) {
int sum = 0 ;
for(int i = 0; i
3rd October : C++ Solution ☝🏼
—————————————————————
🙋🏻♂️Discussion ⁉️
Join ✅ @GFG_Answer
⚡Visit Once Daily To Get FREE Codedamn T-Shirt 👕 —
https://codedamn.com/referred-by/4f24l
class Solution{
public:
string colName (long long int n)
{
string ans="";
while(n){
long long int m=n%26;
n/=26;
if(m==0){
ans+='Z';
n--;
}
else{
char c='A'+m-1;
ans+=c;
}
}
reverse(ans.begin(),ans.end());
return ans;
}
};
