๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
9.63K subscribers
5.6K photos
3 videos
95 files
10.3K 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 <vector>
#include <algorithm>

using namespace std;

bool canRobAll(const vector<int>& houses, int H, int K) {
    int hours_needed = 0;
    for (int house_count : houses) {
        hours_needed += (house_count + K - 1) / K; // Ceiling division
    }
    return hours_needed <= H;
}

int main() {
    int N, H;
    cin >> N >> H;
   
    vector<int> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
   
    int left = 1;
    int right = *max_element(A.begin(), A.end());
   
    while (left < right) {
        int mid = left + (right - left) / 2;
        if (canRobAll(A, H, mid)) {
            right = mid;
        } else {
            left = mid + 1;
        }
    }
   
    cout << left << endl;
   
    return 0;
}

//Richies World
Flipkart โœ…
int countOverlappingPairs(vector<pair<int, int>>& ranges) {
    // Sort ranges by their left boundary
    sort(ranges.begin(), ranges.end());
   
    int n = ranges.size();
    int count = 0;
   
    // Check for overlap between adjacent ranges
    for (int i = 0; i < n - 1; ++i) {
        // If the end of the current range is greater than the start of the next range
        if (ranges[i].second >= ranges[i + 1].first) {
            count++;
        }
    }
   
    return count;
}

Secure the kingdom โœ…
๐Ÿ‘1
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
Photo
#include <bits/stdc++.h>
using namespace std;
#define int long long

double solve(vector<int> &a, vector<int> &b)
{
    int N = a.size();
   
   vector<double>temp;
    for(int i=0;i<N;i++){
         temp.push_back((double)a[i]/94.0);

    }
   vector<int>temp1;
   for(int i=1;i<N;i++){
       temp1.push_back(b[i]-b[i-1]);
   }
   double sum=0;
    for(int i=0;i<temp1.size();i++){
         sum+=temp1[i]/temp[i+1];
    }
    return sum/temp1.size();


}


int32_t main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    vector<int>b(n);
    for(int i=0;i<n;i++){
        cin>>b[i];
    }
   double ans = solve(a,b);
    cout << fixed << setprecision(2);
    cout << ans << endl;
    return 0;
}
//Bob has petrol car

Flipkart โœ…
from collections import defaultdict
def sp(N, K, A):
    if K > N:
        return 0
    freq = defaultdict(int)
    total_abs_diff = 0
    for i in range(K):
        freq[A[i]] += 1
    first_element = A[0]
    last_element = A[K-1]
    total_abs_diff += abs(freq[last_element] - freq[first_element])
    for i in range(1, N-K+1):
        old_element = A[i-1]
        freq[old_element] -= 1
        if freq[old_element] == 0:
            del freq[old_element]
        new_element = A[i+K-1]
        freq[new_element] += 1
        first_element = A[i]
        last_element = A[i+K-1]
        total_abs_diff += abs(freq[last_element] - freq[first_element])
    return total_abs_diff
N, K = map(int, input().split())
A = list(map(int, input().split()))
result = sp(N, K, A)
print(result)


Flipkart โœ…
๐Ÿ‘1
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
Photo
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int SS(const string& rollNumber) {
    int num = 0;
    for (char c : rollNumber) {
        if (isdigit(c)) {
            num = num * 10 + (c - '0');
        }
    }
    return num;
}
bool compare(const pair<string, int>& a, const pair<string, int>& b) {
    string classA = "", classB = "";
    int numA = SS(a.first);
    int numB = SS(b.first);
   
    for (char c : a.first) {
        if (isalpha(c)) classA += c;
        else break;
    }
   
    for (char c : b.first) {
        if (isalpha(c)) classB += c;
        else break;
    }

    if (classA == classB) return numA < numB;
    return classA < classB;
}
int main() {
    int N;
    cin >> N;
    vector<pair<string, int>> students(N);
    for (int i = 0; i < N; ++i) {
        cin >> students[i].first >> students[i].second;
    }
    sort(students.begin(), students.end(), compare);
    for (const auto& student : students) {
        cout << student.first << " " << student.second << endl;
    }
   
    return 0;
}

Flipkart โœ…
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
Photo
import java.util.*;
public class Main {
    public static double calculateTax(double income) {
        double tax = 0.0;
        if (income <= 50000) {
            tax = income * 0.10;
        } else if (income <= 100000) {
            tax = 50000 * 0.10 + (income - 50000) * 0.20;
        } else {
            tax = 50000 * 0.10 + 50000 * 0.20 + (income - 100000) * 0.30;
        }
        return tax;
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        if (n == 0) {
            System.out.println(-1);
            return;
        }
        int noTaxIndex = scanner.nextInt();
        int doubleTaxIndex = scanner.nextInt();
        int discountTaxIndex = scanner.nextInt();
        Map<Integer, Double> houseIncomes = new HashMap<>();
        for (int i = 0; i < n; i++) {
            int houseNumber = scanner.nextInt();
            double income = scanner.nextDouble();
            houseIncomes.put(houseNumber, income);
        }
        double totalTax = 0.0;
        for (Map.Entry<Integer, Double> entry : houseIncomes.entrySet()) {
            double income = entry.getValue();
            double tax = calculateTax(income);

            if (entry.getKey() == noTaxIndex) {
                tax = 0;
            } else if (entry.getKey() == doubleTaxIndex) {
                tax *= 2;
            } else if (entry.getKey() == discountTaxIndex) {
                tax *= 0.90;
            }

            totalTax += tax;
        }

        System.out.println(Math.round(totalTax));
    }
}


Flipkart โœ…
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
Photo
#include <iostream>
#include <vector>
#include <unordered_map>
#include <climits>
using namespace std;

vector<string> findSmallestSubchain(vector<string>& a, vector<string>& b) {
    unordered_map<string, int> c;
    unordered_map<string, int> d;

    for (const string& e : b) {
        c[e]++;
    }

    int e = c.size();
    int f = 0;
    int g = 0, h = 0;
    int i = INT_MAX;
    int j = -1;

    while (h < a.size()) {
        string k = a[h];
        d[k]++;

        if (c.find(k) != c.end() && d[k] == c[k]) {
            f++;
        }

        while (g <= h && f == e) {
            string l = a[g];
            if (h - g + 1 < i) {
                i = h - g + 1;
                j = g;
            }

            d[l]--;
            if (c.find(l) != c.end() && d[l] < c[l]) {
                f--;
            }
            g++;
        }

        h++;
    }

    if (i == INT_MAX) {
        return {};
    }

    vector<string> m(a.begin() + j, a.begin() + j + i);
    return m;
}


Devere โœ…
๐Ÿ“ŒCoretus Technologies Hiring

Want something more than just a conventional tech role? How about creating the next frontier in AI? ๐Ÿค–

1. Business Analyst (Apply here: https://www.coretus.com/career/business-analyst)

2. ReactJS Developer (Apply here: https://www.coretus.com/career/reactjs-developer)

3. NodeJS Developer (Apply here: https://www.coretus.com/career/nodejs-developer)

4. Flutter Developer (Apply here: https://www.coretus.com/career/flutter-developer)

5. Python Developer (Apply here: https://www.coretus.com/career/python-developer)


๐Ÿ“ Location: Rajkot, Gujarat

Got some more questions? Reach out to us on +91-7861077977
For more information, visit: https://www.coretus.com/career
We, at Sub-Same-Day team of Amazon, have two openings for the role of Junior Business Analyst. In this role, you'll play a key role in supporting our efforts to optimize delivery processes and enhance the customer experience.

Who We're Looking For:
ยท     Recent graduate or early career professional with 0-2 years of experience.
ยท     Strong analytical and problem-solving skills with a passion for data-driven decision making.
ยท     Proficient in advanced SQL
ยท     Experience with Python or R is a plus.

Location : Bengaluru (hybrid)

If youโ€™re interested, please mail your resume, along with a short description of your experience in analytics (professional or academic) to kriti.13.sahu@gmail.com.

Freshers are welcome to apply.

I will update this post with official JD
within a few days.