๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
9.63K subscribers
5.61K photos
3 videos
95 files
10.6K 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 <bits/stdc++.h>
#define ll long long
using namespace std;
class FenwickTree {
public:
    FenwickTree(ll n) : bit(n + 1, 0) {}

    void update(ll index, ll value) {
        for (; index < bit.size(); index += index & -index) {
            bit[index] += value;
        }
    }

    ll query(ll index) const {
        ll sum = 0;
        for (; index > 0; index -= index & -index) {
            sum += bit[index];
        }
        return sum;
    }

    ll rangeQuery(ll left, ll right) const {
        return query(right) - query(left - 1);
    }

private:
    vector<ll> bit;
};
ll solve(vector<ll>& a)
{
    ll n=a.size()-1;
    vector<ll>compressed(n+1);
    vector<ll>values(a.begin()+1,a.end());
    sort(values.begin(),values.end());
    values.erase(unique(values.begin(),values.end()),values.end());
    for (ll i=1;i<=n;i++)
    {
        a[i]=lower_bound(values.begin(),values.end(),a[i])-values.begin()+1;
    }
    FenwickTree fenwick(n);
    ll count=0;
    for (ll j=2;j<=n;j++)
    {
        if (a[j]<j) count+=fenwick.query(a[j]-1);
        if (a[j-1]<j-1) fenwick.update(a[j-1],1);
    }
    return count;
}
signed main()
{
    ll n; cin>>n;
    vector<ll>a(n+1);
    for (ll i=1;i<=n;i++)  cin >> a[i];
    cout <<solve(a)<<endl;
    return 0;
}


Pairs of equality
Culfit โœ…
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
Photo
#include <iostream>
#include <vector>
using namespace std;
const int MOD = 1e9 + 7;
int countValidSeries(int n, int m, vector<int>& f) {
    vector<vector<int>> dp(n + 1, vector<int>(m + 1, 0));
    if (f[0] == 0) {
        for (int j = 1; j <= m; ++j) {
            dp[1][j] = 1;
        }
    } else {
        dp[1][f[0]] = 1;
    }
    for (int i = 2; i <= n; ++i) {
        if (f[i-1] == 0) {
            for (int j = 1; j <= m; ++j) {
                dp[i][j] = dp[i-1][j];
                if (j > 1) dp[i][j] = (dp[i][j] + dp[i-1][j-1]) % MOD;
                if (j < m) dp[i][j] = (dp[i][j] + dp[i-1][j+1]) % MOD;
            }
        } else {
            int j = f[i-1];
            dp[i][j] = dp[i-1][j];
            if (j > 1) dp[i][j] = (dp[i][j] + dp[i-1][j-1]) % MOD;
            if (j < m) dp[i][j] = (dp[i][j] + dp[i-1][j+1]) % MOD;
        }
    }
    int result = 0;
    for (int j = 1; j <= m; ++j) {
        result = (result + dp[n][j]) % MOD;
    }
    return result;
}


Flight Series Counter โœ…
L&T Technology Services - MBA Intern Hiring โ€“ 2024 or 2025 pass out batch.

Please register using the below link: https://forms.office.com/pages/responsepage.aspx?id=eDMbMYqOXkujP-gKPYumClSsrm1sEv1BmOXg5_0vsfxUOUY2WUU1MUpRWlBROUtMSFFaSDRSOFZHRi4u

** Please note that applicants that do not fill the above form will not be considered.
Registration End Date: 6:00PM, 31st July 2024

Type: Full time Offline Internship
Location:  Mysore
Specialization:  B. Tech + Mba in Sales & Marketing
Year of Pass out: Batch of 2024 or 2025
Stipend: As per Industry Standards

Job Brief:
    - A Presales Intern acts as a bridge between the sales and technical teams, providing valuable insights and solutions to potential clients.
    -  This role involves a strategic approach to understanding client needs and aligning product or service offerings accordingly.

Requirement and Skills:
    - Excellent communication and presentation skills.
    - Strong analytical and problem-solving abilities.
    - Ability to work collaboratively in a fast-paced and dynamic environment.
๐Ÿ˜ฑ1
#include <iostream> 
#include <vector>

using namespace std;

// Function to find the bitwise OR of sums of all sub-sequences
int bitwiseOrOfSums(const vector<int>& arr) {
    int result = 0;
    for (int num : arr) {
        result |= num;
    }
    return result;
}

int main() {
    int T;
    cin >> T;
    
    while (T--) {
        int N;
        cin >> N;
        vector<int> arr(N);
        
        for (int i = 0; i < N; ++i) {
            cin >> arr[i];
        }
        
        cout << bitwiseOrOfSums(arr) << endl;
    }
    
    return 0;
}

Unify โœ…
import math

def main(input):
    minutes = int(input)
    radius = minutes * 60
    area = 3.14 * (radius ** 2)
    result = math.floor(area)
    print(result)

if __name__ == "__main__":
    user_input = input().strip()
    main(user_input)

Fire in the forest
Unify โœ…
โค1
#include <iostream>
#include <vector>
using namespace std;
int main() {
    int N, Q;
    cin >> N >> Q;
    vector<int> A(N);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }

    vector<int> results(Q);
    for (int q = 0; q < Q; ++q) {
        int L, R, X;
        cin >> L >> R >> X;
        --L;
        --R;
        long long sumXor = 0;
        for (int i = L; i <= R; ++i) {
            sumXor += (A[i] ^ X);
        }
        results[q] = sumXor;
    }
    for (const auto& res : results) {
        cout << res << endl;
    }

    return 0;
}


The XOR Operation โœ…
Unify
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
Photo
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int maxReward(const vector<int>& reward_1, const vector<int>& reward_2, int k) {
    int n = reward_1.size();
    vector<pair<int, int>> diffs(n);
    for (int i = 0; i < n; ++i) {
        diffs[i] = {reward_1[i] - reward_2[i], i};
    }
        sort(diffs.rbegin(), diffs.rend());
   
    int aa = 0;
        for (int i = 0; i < k; ++i) {
        aa += reward_1[diffs[i].second];
    }
   
    for (int i = k; i < n; ++i) {
        aa += reward_2[diffs[i].second];
    }
   
    return aa;
}

Atlassian โœ…
๐Ÿ‘2