๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
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
โ—๏ธENTNT Off Campus Drive 2024 Hiring Junior Software Engineer | 45K-66K Per Monthโ—๏ธ

๐Ÿ‘จโ€๐Ÿ’ปJob Role : Junior Software Engineer
๐ŸŽ“Qualification : B.E/B.Tech
๐ŸŽ–Job Location : Remote
๐Ÿ’ฐSalary : 45K-66K Per Month

โญ•๏ธ Apply Fast :


https://careers.entnt.in/role/a4821cd6-cd96-41c4-b650-bd1a30191ec8
#include <iostream>
#include <vector>

using namespace std;

long makePowerNondecreasing(vector<int>& power) {
    int n = power.size();
    long adjustments = 0;

    for (int i = 1; i < n; ++i) {
        if (power[i] < power[i - 1]) {
            adjustments += power[i - 1] - power[i];
        }
    }

    return adjustments;
} :)

Amazonโœ…
void solve(int m, vector<string>& db, int q, vector<string>& qs) {
    unordered_map<string, pair<string, int>> um;
    unordered_map<string, int> uc;
    for(string& d : db) {
        stringstream ss(d);
        string u, s, a;
        ss >> u >> s >> a;
        um[s] = {a, 0};
        uc[u] = 0;
    }

    for(string& q : qs) {
        if(um.find(q) != um.end()) {
            um[q].second++;
            for(auto& d : db) {
                stringstream ss(d);
                string u, s, a;
                ss >> u >> s >> a;
                if(s == q) {
                    uc[u]++;
                }
            }
            cout << um[q].first << " ";
            for(auto& d : db) {
                stringstream ss(d);
                string u, s, a;
                ss >> u >> s >> a;
                if(s == q) {
                    cout << uc[u] << endl;
                }
            }
        }
    }
}

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

class SinglyLinkedListNode {
public:
    string data;
    SinglyLinkedListNode* next;

    SinglyLinkedListNode(string value) {
        data = value;
        next = nullptr;
    }
};

SinglyLinkedListNode* getShoppingCart(SinglyLinkedListNode* head, vector<vector<string>> queries) {
    for (auto& query : queries) {
        string action = query[0];
        string item_name = query[1];

        if (action == "PUSH_HEAD") {
            SinglyLinkedListNode* new_node = new SinglyLinkedListNode(item_name);
            new_node->next = head;
            head = new_node;
        } else if (action == "PUSH_TAIL") {
            SinglyLinkedListNode* new_node = new SinglyLinkedListNode(item_name);
            if (head == nullptr) {
                head = new_node;
            } else {
                SinglyLinkedListNode* current = head;
                while (current->next != nullptr) {
                    current = current->next;
                }
                current->next = new_node;
            }
        } else if (action == "POP_HEAD") {
            if (head != nullptr) {
                SinglyLinkedListNode* temp = head;
                head = head->next;
                delete temp;
            }
        }
    }

    return head;
}

Amazon โœ…
โค1
import java.util.*;

class Main {
  public static void main (String[] args) {
    Scanner sc=new Scanner(System.in);
    List<Integer> arr=new ArrayList<>();
    int n=sc.nextInt(),i;
    for(i=0;i<n;i++){
        arr.add(sc.nextInt());
    }
    int m=sc.nextInt();
    long ans=solution(arr,m);
    System.out.println(ans);
  }
  public static long solution(List<Integer> arr,int m){
      PriorityQueue<Integer> pq=new PriorityQueue<>(Collections.reverseOrder());
      for(int i=0;i<arr.size();i++) pq.add(arr.get(i));
      long ans=0;
      for(int i=0;i<m;i++){
        int top=pq.poll();
        ans+=top/2;
        pq.add(top-top/2);
    }
    return ans;
  }
}

Candyman โœ