๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
9.52K subscribers
5.56K photos
3 videos
95 files
9.66K 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
long getMaxProfit(vector<int> pnl, int k) {
    int n = pnl.size();
    long maxprofit = 0;
    int i;
    long profit = 0;
    int start = 0;
    for(i=0;i<n;i++) {
        profit += pnl[i];
        if (profit <= 0) {
            profit = 0;
            start = i+1;
        } else {
            maxprofit = max(maxprofit , profit);
            if (i-start+1 == k) {
              
                profit -= pnl[start];
                start++;
            }
            while(pnl[start] <= 0 && start <=i) {
                profit -= pnl[start];
                maxprofit = max(maxprofit , profit);
                start++;
            }
        }
    }
    return maxprofit;
}



Profit Analysis โœ…
I am not sure if you guys are aware or not but there are many scammers in Telegram who may ask you to pay them 200 rs and will give 1250 after sometime, never ever reply to those fraud people. Never ever pay any money to anyone in telegram for the sake of getting it double or whatsoever.
Be smart, stay safe โค๏ธ
#include <iostream>
#include <vector>
#include <unordered_map>
#include <set>
#include <algorithm>
using namespace std;
long long minimumCost(vector<int>& arr) {
    unordered_map<int, int> freq;
    for (int num : arr) {
        freq[num]++;
    }
    vector<pair<int, int>> elements;
    for (const auto& entry : freq) {
        elements.push_back(entry);
    }
    sort(elements.begin(), elements.end(), [](pair<int, int>& a, pair<int, int>& b) {
        return a.second > b.second;
    });
    set<int> distinct;
    long long totalCost = 0;
    for (const auto& element : elements) {
        for (int i = 0; i < element.second; ++i) {
            distinct.insert(element.first);
            totalCost += distinct.size();
        }
    }
    return totalCost;
}


IBM โœ…
SELECT product_name, cost AS product_cost, category AS product_category
FROM products AS p1
WHERE cost = (
    SELECT MAX(cost)
    FROM products AS p2
    WHERE p1.category = p2.category
)
ORDER BY product_cost DESC, product_name ASC;

Fractalโœ