๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
9.62K subscribers
5.59K photos
3 videos
95 files
10.2K links
๐ŸšฉMain Group - @SuperExams
๐Ÿ“Job Updates - @FresherEarth

๐Ÿ”ฐAuthentic Coding Solutions(with Outputs)
โš ๏ธDaily Job Updates
โš ๏ธHackathon Updates & Solutions

Buy ads: https://telega.io/c/cs_algo
Download Telegram
#include <iostream>
#include <unordered_map>
#include <string>
#include <algorithm>

using namespace std;

int main() {
    int n;
    cin >> n;
    cin.ignore(); // Consume the newline after the integer input

    unordered_map<string, int> hashtagCount;

    // Read n events
    for (int i = 0; i < n; ++i) {
        string line;
        getline(cin, line);

        size_t hashtagStart = line.find('#');
        if (hashtagStart != string::npos) {
            size_t delimiterStart = line.find(" || ", hashtagStart);
            if (delimiterStart != string::npos) {
                string hashtag = line.substr(hashtagStart, delimiterStart - hashtagStart);

                // Increment the count of the hashtag
                hashtagCount[hashtag]++;
            }
        }
    }

    // Finding the most frequent hashtag
    string mostFrequentHashtag;
    int maxCount = 0;

    for (const auto& entry : hashtagCount) {
        if (entry.second > maxCount) {
            mostFrequentHashtag = entry.first;
            maxCount = entry.second;
        }
    }

    cout << mostFrequentHashtag << endl;

    return 0;
}


Hashtag
C++โœ…
Wayfair
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
#include <iostream> #include <unordered_map> #include <string> #include <algorithm> using namespace std; int main() {     int n;     cin >> n;     cin.ignore(); // Consume the newline after the integer input     unordered_map<string, int> hashtagCount;โ€ฆ
string solve(vector<string> arr){
    int n=arr.size();
    map<string,set<string>> mp;
    for(auto x:arr){
        // AliceBobkisi||
        string temp="";
        vector<string> v;
        for(int i=0;i<x.size();i++){
            if(x[i]=='|'){
                v.push_back(temp);
                i++;
                temp="";
            }
            else{
                temp+=x[i];
            }
        }
        v.push_back(temp);
        v.pop_back();
        if(v.back().size()){
            mp[v[0]].insert(v.back());
        }
    }
    int maxi=0;
    for(auto x:mp){
        maxi=max(maxi,(int)x.second.size());
    }
    if(maxi==0){
        return "None";
    }
    else{
        for(auto x:mp){
            if(x.second.size()==maxi){
                return x.first;
            }
        }
    }
}

Hashtag code โœ…
def mowgliDoors(S):
    count = int(S[0] == '0')
   
    for i in range(1, len(S)):
        if S[i] != S[i - 1]:
            count += 1
   
    return count

test_cases = ['111', '010', '10011']
for test_case in test_cases:
    result = mowgliDoors(test_case)
    print(result)

Mogali โœ