allcoding1
27.7K subscribers
2.2K photos
2 videos
77 files
852 links
Download Telegram
int n=sc.nextInt(),i;
            int a[]=new int[n];
            for(i=0;i<n;i++) a[i]=sc.nextInt();
            int dp[]=new int[n];
        dp[0]=a[0];
        if(n>1)
            dp[1]=Math.max(a[0],a[1]);
        if(n>2)
            dp[2]=Math.max(a[0]+a[2],a[1]);
            for( i=3;i<n;i++)
                dp[i]=Math.max(a[i]+dp[i-2],dp[i-1]);
        System.out.println(dp[n-1]);

Special Sum
Intuit
👍1
Spreading Fire
Intuit
C
👍1
allcoding1
Photo
class TreeNode:
    def init(self, val):
        self.val = val
        self.children = []

def build_tree(units, relationships):
    nodes = {i: TreeNode(units[i]) for i in range(len(units))}
    for rel in relationships:
        parent, child = rel
        nodes[parent].children.append(nodes[child])
    return nodes[0] 

def max_electricity_per_floor(root):
    max_electricity = 0
    floor_electricity = {}
   
    def dfs(node, level):
        nonlocal max_electricity
        if level not in floor_electricity:
            floor_electricity[level] = 0
        floor_electricity[level] += node.val
        max_electricity = max(max_electricity, floor_electricity[level])
        for child in node.children:
            dfs(child, level + 1)
   
    dfs(root, 0)
    return max_electricity


num = int(input())
units = list(map(int, input().split()))
numRel, memConnect = map(int, input().split())
relationships = [tuple(map(int, input().split())) for _ in range(numRel)]


root = build_tree(units, relationships)


result = max_electricity_per_floor(root)
print(result)
Apartment one


@allcoding1
👍31
int main() {
ll N;
cin >> N;

vector<ll> u(N);
for(ll i = 0; i < N; ++i) {
cin >> u[i];
}

ll M, X;
cin >> M >> X;

vector<vector<ll>> a(N);
for(ll i = 0; i < M; ++i) {
ll x, y;
cin >> x >> y;
a[x].push_back(y);
a[y].push_back(x);
}

vector<bool> v(N, false);
queue<ll> q;
q.push(0);
v[0] = true;

ll m = 0;
while(!q.empty()) {
ll s = q.size();
ll us = 0;
for(ll i = 0; i < s; ++i) {
ll n = q.front();
q.pop();
us += u[n];
for(ll nb : a[n]) {
if(!v[nb]) {
q.push(nb);
v[nb] = true;
}
}
}
m = max(m, us);
}

cout << m << endl;

return 0;
}



apartment

@allcoding1
👍1
int main() {
ll N;
cin >> N;

vector<ll> w(N);
for(ll i = 0; i < N; ++i) {
cin >> w[i];
}

vector<ll> s(N, 15);
for(ll i = N-2; i >= 0; --i) {
for(ll j = i+1; j < N; ++j) {
if(w[i] < w[j]) {
s[i] = 10;
for(ll k = j+1; k < N; ++k) {
if(w[j] > w[k]) {
s[i] = 5;
break;
}
}
break;
}
}
}

ll g = 0;
for(ll sc : s) {
g += sc;
}

cout << g << endl;

return 0;
}


chair manufacture

@allcoding1
👍4
Forwarded from allcoding1
🎯SAS Off Campus Drive 2024 – Associate Software Engineer – Freshers | Rs 4-8 LPA

Job Role : Associate Software Developer
Qualification : B.E/B/Tech/M.E. / M.Tech
Experience : Freshers
Job Location : Pune
Package : Rs 4-8 LPA

Apply Now:- https://www.allcoding1.com/2024/02/sas-off-campus-drive-2024-associate_9.html?m=1

Telegram:- @allcoding1
char solve(string o, string r) {
    string res = "";
    int j = 0;
    for (int i = 0; i < o.size(); i++) {
        if (o[i] != r[j]) {
            res += o[i];
        } else {
            j++;
        }
    }
    return res[0];
}

Tech Mahindra

telegram:- @allcoding1
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin >> s;
    int n;
    cin >> n;
    for (int i = n; i < s.size() + n; i++)
    {
        cout << s[i % s.size()];
    }
    return 0;
}
C++

Tech Mahindra

Telegram @allcoding1
👍4
#include <bits/stdc++.h>
using namespace std;

int main()
{
    string s;
    cin >> s;
    int ans = 0;
    map<char, int> m;
    for (int i = 0; i < s.size(); i++)
    {
        m[s[i]]++;
    }
    for (auto x : m)
    {
        if (x.second == 1)
            ans++;
    }
    cout << ans;
    return 0;
}

Tech Mahindra
C++

Tech Mahindra

Telegram @allcoding1
👍5
IBM
👍2
hours = int(input())
seconds = hours * 60 * 60
print(seconds)

Deloitte
👍2🤩1
500 TB Tutorials + Books + Courses + Trainings + Workshops + Educational Resources

🔹Data science
🔹Python
🔹Artificial Intelligence
🔹AWS Certified
🔹Cloud
🔹BIG DATA
🔹Data Analytics
🔹BI
🔹Google Cloud Platform
🔹IT Training
🔹MBA
🔹Machine Learning
🔹Deep Learning
🔹Ethical Hacking
🔹SPSS
🔹Statistics
🔹Data Base
🔹Learning language resources ( English🏴󐁧󐁢󐁥󐁮󐁧󐁿 , French🇨🇵 , German🇩🇪 )


₹50

Contact:- @meterials_available
👍5🥰1🎉1
🎯Mitsogo fresher hiring all batches

Apply:- https://www.mitsogo.com/career/opportunities-for-freshers/

Telegram:- @allcoding1