๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
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
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
Photo
def getSeatsAllocation(arr):
    n = len(arr)
    ppl = [[] for i in range(2 * n + 4)]
   
    for i, x in enumerate(arr):
        ppl[x].append(i)

    h = []
    ans = [-1] * n
   
    for pos in range(1, 2 * n + 1):
        for i in ppl[pos]:
            heapq.heappush(h, (-pos, i))
       
        if len(h) > 0:
            ans[heapq.heappop(h)[1]] = pos
   
    return ans

BNY(Intern)โœ…
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
Photo
import java.util.*;
public class StockPrediction {

    public List<Integer> predict(List<Integer> stockData, List<Integer> queries) {
        List<Integer> result = new ArrayList<>();
        int n = stockData.size();
       
        TreeSet<Integer> treeSet = new TreeSet<>(stockData);
       
        if (treeSet.size() == 1) {
            Collections.fill(result, -1);
            return result;
        }
       
        for (int query : queries) {
            int stockPrice = stockData.get(query - 1);
           
            if (treeSet.first() >= stockPrice) {
                result.add(-1);
                continue;
            }
           
            int nearestDay = -1;
            int left = query - 2;
            int right = query;
            while (left >= 0 || right < n) {
                if (left >= 0 && stockData.get(left) < stockPrice) {
                    nearestDay = left + 1;
                    break;
                }
                if (right < n && stockData.get(right) < stockPrice) {
                    nearestDay = right + 1;
                    break;
                }
                left--;
                right++;
            }
           
            result.add(nearestDay);
        }
       
        return result;
    }


BNY(intern)โœ…
#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define vll vector<ll>

struct M {
    ll s;
    ll r;
};

bool cmp(M a, M b) {
    return a.r > b.r;
}

ll solve(vll& s, vll& r, ll m) {
    ll n = s.size();
    vector<M> v(n);
    for(ll i=0; i<n; i++) {
        v[i].s = s[i];
        v[i].r = r[i];
    }
    sort(v.begin(), v.end(), cmp);
    priority_queue<ll, vll, greater<ll>> q;
    ll ts = 0, mq = 0;
    for(ll i=0; i<n; i++) {
        ts += v[i].s;
        q.push(v[i].s);
        if(q.size() > m) {
            ts -= q.top();
            q.pop();
        }
        mq = max(mq, ts * v[i].r);
    }
    return mq;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
   
    ll n;
    cin >> n;
    vll s(n), r(n);
    for(ll i=0; i<n; i++) {
        cin >> s[i];
    }
    for(ll i=0; i<n; i++) {
        cin >> r[i];
    }
    ll m;
    cin >> m;
    cout << solve(s, r, m) << endl;
    return 0;
}

BNY (intern) โœ…
๐Ÿ‘1
from collections import defaultdict

def cheapestFare(n_towns, source, destination, max_stops, routes):
    graph = defaultdict(list)
    for start, end, cost in routes:
        graph[start].append((end, cost))
   

    costs = [float('inf')] * n_towns
    costs[source] = 0
   
    for i in range(max_stops + 1):
        new_costs = costs.copy()
        for start in range(n_towns):
            if costs[start] == float('inf'):
                continue
            for end, cost in graph[start]:
                new_costs[end] = min(new_costs[end], costs[start] + cost)
        costs = new_costs
   
    return costs[destination] if costs[destination] != float('inf') else -1

Trip planner
Makemytripโœ…
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
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;
}

int main() {
    int n, m;
    cout << "Enter the number of elements (n) and the maximum value (m): ";
    cin >> n >> m;

    vector<int> f(n);
    cout << "Enter the series (0 for unknown, or an integer value for known positions): ";
    for (int i = 0; i < n; ++i) {
        cin >> f[i];
    }

    int result = countValidSeries(n, m, f);
    cout << "The number of valid series is: " << result << endl;

    return 0;
}

Flight series Counterโœ…
void fun(int i,int n,vector<int>&p,vector<int>&c,int x,int y,map<int,int>&m){
        if(i==n){
            m[x] = max(m[x],y);
            return ;
        }
        fun(i+1,n,p,c,x+p[i],y+c[i],m);
        fun(i+1,n,p,c,x,y,m);
        return ;
}

int solve(vector<int>&p,vector<int>&c,int w){

int n = p.size();

map<int,int>m1,m;
fun(0,n/2,p,c,0,0,m);
int x = 0;


for(auto &it:m){
      x=max(it.second,x);
      it.second = x;
}

fun(n/2,n,p,c,0,0,m1);

x=0;
for(auto &it:m1){
      x=max(it.second,x);
      it.second = x;
}

int ans = 0;

for(auto it:m){
     int r = w-it.first;
     auto itt = m1.upper_bound(r);
     if(itt != m1.begin()){
      itt--;
      ans = max(it.second+itt->second,ans);
     }
}

for(auto it:m1){
     int r = w-it.first;
     auto itt = m.upper_bound(r);
     if(itt != m.begin()){
      itt--;
      ans = max(it.second+itt->second,ans);
     }
}

return ans;

}

Getmaxquantityโœ…
BNY Mellon
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
from collections import defaultdict def cheapestFare(n_towns, source, destination, max_stops, routes):     graph = defaultdict(list)     for start, end, cost in routes:         graph[start].append((end, cost))         costs = [float('inf')] * n_towns    โ€ฆ
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll solve(ll n, vector<vector<ll>>& flights, ll src, ll dst, ll k)
{
      vector<pair<ll,ll>> adj[n];
        for(auto it : flights){
            adj[it[0]].push_back({it[1],it[2]});
        }
        queue<pair<ll,pair<ll,ll>>>q;
        q.push({0,{src,0}});
        vector<ll>dist(n,1e9);
        dist[src]=0;
        while(!q.empty()){
            auto it=q.front();
            q.pop();
            ll stops=it.first;
            ll node=it.second.first;
            ll wt=it.second.second;
            if(stops>k)continue;
            for(auto iter:adj[node]){
                ll adjnode=iter.first;
                ll dis=iter.second;
                if(wt+dis<dist[adjnode]&&stops<=k){
                    dist[adjnode]=wt+dis;
                    q.push({stops+1,{adjnode,wt+dis}});
                }
            }
        }
        if(dist[dst]==1e9)return -1;
        return dist[dst];
}
signed main()
{
    ll n,src,des,k,m; cin>>n>>src>>des>>k>>m;
    vector<vector<ll>>a(m,vector<ll>(3));
    for(ll i=0;i<m;i++)
    {
       ll x,y,w; cin>>x>>y>>w;
       a[i]={x,y,w};
    }
    cout <<solve(n,a,src,des,k)<<endl;
    return 0;
}

Trip planner โœ…
Need HR for HR operations for Wipro๐Ÿ’ฅ๐Ÿ’ฅ๐Ÿ’ฅ

Experience: 0-3 years

Salary: 3 LPA

Date of offline Interview:22nd August, 2024

Time: 10.30 AM โ€“ 11.30 AM

Address:Gigaplex Building 3, Mindspace โ€“ Airoli West, 3rd Floor, Plot no. 1.T.5, MIDC, Airoli โ€“ 400708


Skills/Requirements: ๐Ÿ˜Š๐Ÿ˜Š
1. Understanding and implementing company HR policies, as well as ensuring compliance with labor laws and regulations.
2. Managing HR processes efficiently, including employee records, payroll, benefits administration, and onboarding/offboarding procedures.
3. Effectively communicating with employees, management, and external partners to address HR-related inquiries and provide clear guidance on HR processes.
4. Identifying and resolving HR issues or discrepancies, such as payroll errors, benefits concerns, or employee relations matters, with a proactive and solution-oriented approach.
#include <bits/stdc++.h>
using namespace std;
#define int long long

int dp[1005][1005][2];

int arr[10005];
int n;
int k;

int rec(int i, int curr, bool is)
{

    if (i >= n)
    {
        if (curr == k)
        {
            return 0;
        }
        else
            return -1e18;
    }
    if (curr > k)
        return -1e17;

    if (dp[i][curr][is] != -1)
        return dp[i][curr][is];

    if (is == 0)
    {
        int opt1 = rec(i + 1, curr, 0);
        int opt2 = (curr)*arr[i] + rec(i + 1, curr, 1);
        int opt3 = curr * arr[i] + rec(i + 1, curr + 1, 0);

        return dp[i][curr][is] = max({opt1, opt2, opt3});
    }

    else
    {

        int opt1 = (curr)*arr[i] + rec(i + 1, curr, 1);
        int opt2 = curr * arr[i] + rec(i + 1, curr + 1, 0);

        return dp[i][curr][is] = max(opt1, opt2);
    }
}

int32_t main()
{

    cin >> n >> k;
    for (int i = 0; i < n; i++)
        cin >> arr[i];
    memset(dp, -1, sizeof(dp));

    int cnt = rec(0, 1, 0);

    cout << cnt << endl;
    return 0;
}

GetmaxBeauty โœ…
BNY Mellon
public static int getMaxEfficiency(int[] arrivalTime) {
        Arrays.sort(arrivalTime);
       
        int maxEfficiency = Integer.MIN_VALUE; 
        int n = arrivalTime.length;
        int left = 0;

        for (int right = 1; right < n; right++) {
            while (left < right && arrivalTime[right] - arrivalTime[left] > right - left) {
                left++;
            }
            int activeTime = arrivalTime[right] - arrivalTime[left];
            int testCases = right - left + 1;
            int efficiency = testCases - activeTime;
            maxEfficiency = Math.max(maxEfficiency, efficiency);
        }

        return maxEfficiency;
    }

Expedia โœ…
techolution is looking for talented Python Interns to join our innovative team.

Location: Hyderabad (Onsite)
Eligible Batch: 2024/2025
Duration: 6 months - 12 months

Key Skills Required to Apply:
Proficiency in Modular Object Oriented Python Coding.
Experience with Flask/Django/FastAPl
Strong knowledge of Data Structures & Algorithms
Exposure to backend development
Knowledge of microservices architecture
Familiarity with cloud platforms (AWS/Azure/GCP)
Deployment experience with Docker/Kubernetes

If you believe that you match the criteria, share your resume at cavery.mahajan@techolution.com
๐Ÿ‘1