Coding | EXAMS | IBM ACCENTURE | VIRTUSA | IBM | AMAZON | TCS | EPAM | WILEY EDGE | TECH MAHINDRA | JPMORGAN | HCL | WIPRO
3.37K subscribers
1.13K photos
3 videos
17 files
373 links
Main channel https://t.me/Coding_000
Contact Admin 👉 @ILOVEU_143 for booking your exam slots
Web- https://coding000.github.io/Projects/
💯% clearance in any placement exams
OffCampus -https://t.me/Offcampus_000
Discussion- https://t.me/exams_discussion
Download Telegram
def calculate_xor(nums):
    xor_val = 0
    for num in nums:
        xor_val ^= num
    return xor_val


def maximum_beauty(A, D, N, M):
    blocks = {}
    parent = list(range(N))
    rank = [1] * N
    beauty = []

    for i in range(N):
        blocks[i] = [A[i]]

    def find_parent(x):
        if parent[x] != x:
            parent[x] = find_parent(parent[x])
        return parent[x]

    def merge_blocks(x, y):
        px = find_parent(x)
        py = find_parent(y)
        if px == py:
            return

        if rank[px] > rank[py]:
            parent[py] = px
            blocks[px].extend(blocks[py])
            rank[px] += rank[py]
        else:
            parent[px] = py
            blocks[py].extend(blocks[px])
            rank[py] += rank[px]

    for i in range(M):
        obj1 = i * 2
        obj2 = i * 2 + 1
        merge_blocks(obj1, obj2)

    for decay_obj in D:
        beauty.append(calculate_xor(blocks[find_parent(decay_obj)]))

        parent_block = find_parent(decay_obj)
        parent_block_objs = blocks[parent_block]
        parent_block_objs.remove(A[decay_obj])

        if not parent_block_objs:
            del blocks[parent_block]

    return beauty


N = int(input("Enter the number of objects (N): "))
M = int(input("Enter the number of object links (M): "))

print("Enter the values of the objects:")
A = [int(input()) for _ in range(N)]

K = int(input("Enter the order of object decay (K): "))

print("Enter the indices of the objects in the order of decay:")
D = [int(input()) for _ in range(K)]

result = maximum_beauty(A, D, N, M)

print("Maximum beauty of blocks before object decay:", *result)


building block
👍1
long long superMovement(int n, vector<int> &a, int k) {
    // Write your code here.
    vector<long long> v(k - 1, LLONG_MAX);  // Use LLONG_MAX for long long
    long long ans = 0;
    int j = 0;

    for (int i = 0; i < n - 1; i++) {
        if (j == k - 1) {
            j = 0;
            continue;
        }

        long long x = abs(a[i] - a[i + 1]);
        v[j] = min(v[j], x);
        j++;
    }

    for (auto i : v) {
        ans += i;
    }

    return ans;
}
👍2
*Fighting traffic code!!*

int getTotalFun(int n, int m, const vector<vector<int>>& graph, const vector<int>& f, int tolerance) {
    vector<int> visited(n, 0);
    int totalFun = 0;
    queue<int> q;
    q.push(0);
    visited[0] = 1;

    while (!q.empty()) {
        int city = q.front();
        q.pop();
        totalFun |= f[city];

        for (int neighbor : graph[city]) {
            if (visited[neighbor] == 0 && tolerance >= 0) {
                q.push(neighbor);
                visited[neighbor] = 1;
            }
        }
    }

    return totalFun;
}
int fightingTraffic(int n, int m, vector<vector<int>> &roads, vector<int> &t, vector<int> &f, int x) {
    // Write your code here.
        int low = 0; // Minimum traffic tolerance
    int high = 1e9; // Maximum traffic tolerance
    int result = -1;

    while (low <= high) {
        int mid = low + (high - low) / 2;
        vector<vector<int>> graph(n);

        for (int i = 0; i < m; i++) {
            int city1 = roads[i][0];
            int city2 = roads[i][1];
            int traffic = t[i];

            if (traffic <= mid) {
                graph[city1].push_back(city2);
                graph[city2].push_back(city1);
            }
        }

        int totalFun = getTotalFun(n, m, graph, f, mid);
        if (totalFun >= x) {
            result = mid;
            high = mid - 1;
        } else {
            low = mid + 1;
        }
    }

    return result;
}
👍4
import java.util.*;
public class Solution {
    static int[] buildingBlocks(int n, int m, int[][] links, int[] a, int k, int[] d) {
        // Write your code here.
        int[] ans = new int[k];
        List<Set<Integer>> adj = new ArrayList<>();
        for(int i = 0; i < n; i++) adj.add(new HashSet<>());
        for(int i = 0; i < m; i++){
            adj.get(links[i][0]).add(links[i][1]);
            adj.get(links[i][1]).add(links[i][0]);
        }
        Set<Integer> decay = new HashSet<>();

        for(int i = 0; i < k; i++){
            if(i != 0){
                removeNode(adj, d[i - 1]);
                decay.add(d[i - 1]);
            }
            ans[i] = solve(adj, decay, a);
           
        }
        return ans;
    }
    static void removeNode(List<Set<Integer>> adj, int node){
        for(int i = 0; i < adj.size(); i++){
            Set<Integer> curr = adj.get(i);

            if(curr.contains(node)) curr.remove(node);
        }
    }
    static int solve(List<Set<Integer>> adj, Set<Integer> decay, int[] a){
        int ans = 0;
        int[] visited = new int[adj.size()];
        for(int i = 0; i < adj.size(); i++){
            if(decay.contains(i)) continue;
            else if(visited[i] == 0){
                ans = Math.max(ans, dfs(adj, i, visited, a));
            }
        }
        return ans;
    }

    static int dfs(List<Set<Integer>> adj, int curr, int[] visited, int[] a){
        visited[curr] = 1;
        int ans = a[curr];
        Set<Integer> set = adj.get(curr);
        for(int i : set){
            if(visited[i] == 0){
                ans ^= dfs(adj, i, visited, a);
            }
        }
        return ans;
    }
}
👍3
#include <vector>
using namespace std;

typedef long long ll;

bool fn(vector<int>& a, vector<int>& b, ll x, ll mid) {
    int n = a.size();
    vector<int> vis(n, 0);
    ll sum = 0;

    for (int i = 0; i < n; i++) {
        if (b[i] <= mid) {
            sum += a[i];
            vis[i] = 1;
        }
    }

    ll mx = 0;

    for (int i = 0; i < n; i++) {
        if (!vis[i]) {
            mx = max(mx, static_cast<ll>(a[i]));
        }
    }

    return sum + mx >= x;
}

int scoreAndCost(int n, vector<int>& a, vector<int>& b, int x) {
    ll ans = -1;
    ll s = 0, e = 1e9;

    while (s <= e) {
        ll mid = (s + e) / 2;

        if (fn(a, b, x, mid)) {
            ans = mid;
            e = mid - 1;
        } coding_000
        else {
            s = mid + 1;
        }
    }

    return static_cast<int>(ans);
}
100% working score and cost
👍3
Helo guys...I am back..again

Help available in all exams

contact me @ILOVEU_143

Share @coding_000👨‍💻
👍1🤩1😎1
https://drive.google.com/drive/folders/1-xmLdiHEtepyVeam-z2j3KdhZWPfCmL4

Complete Frontend + Server side Resources, Ebooks, Notes, Interview Questions Everything 🤩

React with any random emoji, if you can access the resources 😄🔥

Hope this helps you!!
❤️

Share @Coding_000👨‍💻
6🥰2🔥1👏1🤩1😎1
Visa Mock Interview available

Anyone need DM @Iloveu_143👨‍💻

Full visa preparation materials and mock to be taken....Daily..😊
👍4
No need to hustle for job opportunities anymore, Be with us, I will try to post every job opportunities.

Devote your time for preparation, just check channel twice a day.

Share @Offcampus_000❤️
👍1🤩1
TATA STEEL SOLUTION :-

share @coding_000❤️

Hit like 👍👍 those who have TATA steel exam Today
👍12
Accenture Hiring

Role: System and Application Services Associate

YOP: 2022, 2023

Salary: 3.3 LPA

Apply link:

https://indiacampus.accenture.com/myzone/accenture/1/jobs/3627/job-details
👍3🥰1👏1
Accenture
Any  oncampus/ Offcampus Exam help available 🔥💯

Book your slot

Contact here
@ILOVEU_143❤️

100% clearance guarantee👨‍💻🔥


𝗧𝗲𝘀𝘁 𝗖𝗹𝗲𝗮𝗿𝗮𝗻𝗰𝗲 𝗚𝘂𝗮𝗿𝗮𝗻𝘁𝗲𝗲𝗱
𝗬𝗼𝘂𝗿 𝗝𝗼𝗯 𝗢𝘂𝗿 𝗥𝗲𝘀𝗽𝗼𝗻𝘀𝗶𝗯𝗶𝗹𝗶𝘁𝘆 😊
👍1🥰1🤩1