๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
#include <iostream>
#include <vector>
#include <unordered_map>
#include <algorithm>
using namespace std;
int findMinSum(const vector<int>& arr, int z, int k) {
int n = arr.size();
int minSum = k + 1;
for (int i = 0; i < n; ++i) {
for (int j = 0; j < n; ++j) {
for (int a = 0; a <= k; ++a) {
int rem = z - a * arr[i];
if (rem < 0) break;
if (rem % arr[j] == 0) {
int b = rem / arr[j];
if (a + b <= k) {
minSum = min(minSum, a + b);
}
}
}
}
}
return (minSum <= k) ? minSum : -1;
}
vector<int> solve(const vector<int>& arr, const vector<int>& query, int k) {
vector<int> result;
for (int z : query) {
int minSum = findMinSum(arr, z, k);
result.push_back(minSum);
}
return result;
}
Solving linear Equationโ
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = LLONG_MAX;
vector<ll> dijkstra(int n, int src, const vector<vector<pair<int, int>>>& adj) {
vector<ll> dist(n, INF);
dist[src] = 0;
priority_queue<pair<ll, int>, vector<pair<ll, int>>, greater<>> pq;
pq.push({0, src});
while (!pq.empty()) {
auto [d, u] = pq.top();
pq.pop();
if (d > dist[u]) continue;
for (auto [v, cost] : adj[u]) {
if (dist[u] + cost < dist[v]) {
dist[v] = dist[u] + cost;
pq.push({dist[v], v});
}
}
}
return dist;
}
vector<vector<ll>> shortest(int nodes, const vector<int>& deliveries, const vector<vector<pair<int, int>>>& adj) {
int k = deliveries.size();
vector<vector<ll>> dist(k, vector<ll>(nodes));
for (int i = 0; i < k; ++i) {
dist[i] = dijkstra(nodes, deliveries[i], adj);
}
return dist;
}
ll minTime(int nodes, int k, const vector<ll>& startDist, const vector<vector<ll>>& dist, const vector<int>& deliveries) {
vector<vector<ll>> dp(1 << k, vector<ll>(k, INF));
for (int i = 0; i < k; ++i) {
dp[1 << i][i] = startDist[deliveries[i]];
}
for (int mask = 0; mask < (1 << k); ++mask) {
for (int i = 0; i < k; ++i) {
if (mask & (1 << i)) {
for (int j = 0; j < k; ++j) {
if (!(mask & (1 << j))) {
dp[mask | (1 << j)][j] = min(dp[mask | (1 << j)][j], dp[mask][i] + dist[i][deliveries[j]]);
}
}
}
}
}
ll minTime = INF;
for (int i = 0; i < k; ++i) {
minTime = min(minTime, dp[(1 << k) - 1][i] + dist[i][0]);
}
return minTime;
}
long long getMinimumTime(int n, vector<int> from, vector<int> to, vector<int> weight, vector<int> del) {
int m = from.size();
vector<vector<pair<int, int>>> adj(n);
for (int i = 0; i < m; ++i) {
adj[from[i]].emplace_back(to[i], weight[i]);
adj[to[i]].emplace_back(from[i], weight[i]);
}
vector<ll> start = dijkstra(n, 0, adj);
vector<vector<ll>> dist = shortest(n, del, adj);
ll mini = minTime(n, del.size(), start, dist, del);
return (mini == INF) ? -1 : mini;
}
Optimizing Delivery โ
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
struct Cell {
int r, c;
};
int n, m;
vector<vector<int>> dist;
vector<string> grid;
vector<pair<int, int>> directions = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};
void bfsFromObstacles() {
queue<Cell> q;
dist = vector<vector<int>>(n, vector<int>(m, 1e9));
for (int r = 0; r < n; r++) {
for (int c = 0; c < m; c++) {
if (grid[r][c] == '*') {
q.push({r, c});
dist[r][c] = 0;
}
}
}
while (!q.empty()) {
Cell cur = q.front();
q.pop();
for (auto dir : directions) {
int nr = cur.r + dir.first;
int nc = cur.c + dir.second;
if (nr >= 0 && nr < n && nc >= 0 && nc < m && dist[nr][nc] > dist[cur.r][cur.c] + 1) {
dist[nr][nc] = dist[cur.r][cur.c] + 1;
q.push({nr, nc});
}
}
}
}
bool canReachWithMinDist(int mid, Cell start, Cell end) {
if (dist[start.r][start.c] < mid) return false;
queue<Cell> q;
vector<vector<bool>> visited(n, vector<bool>(m, false));
q.push(start);
visited[start.r][start.c] = true;
while (!q.empty()) {
Cell cur = q.front();
q.pop();
if (cur.r == end.r && cur.c == end.c) return true;
for (auto dir : directions) {
int nr = cur.r + dir.first;
int nc = cur.c + dir.second;
if (nr >= 0 && nr < n && nc >= 0 && nc < m && !visited[nr][nc] && dist[nr][nc] >= mid) {
visited[nr][nc] = true;
q.push({nr, nc});
}
}
}
return false;
}
int findMaximumDistance(vector<string>& gridInput) {
grid = gridInput;
n = grid.size();
m = grid[0].size();
Cell start, end;
for (int r = 0; r < n; r++) {
for (int c = 0; c < m; c++) {
if (grid[r][c] == 'S') {
start = {r, c};
}
if (grid[r][c] == 'E') {
end = {r, c};
}
}
}
bfsFromObstacles();
int lo = 0, hi = n + m, ans = 0;
while (lo <= hi) {
int mid = (lo + hi) / 2;
if (canReachWithMinDist(mid, start, end)) {
ans = mid;
lo = mid + 1;
} else {
hi = mid - 1;
}
}
return ans;
}
Ebullient โ
Maximum Distance
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
def bfs_from_obstacles(g, n, m):
d = [[-1] * m for _ in range(n)]
q = [(i, j) for i in range(n) for j in range(m) if g[i][j] == '*']
for x, y in q: d[x][y] = 0
dirs = [(1, 0), (-1, 0), (0, 1), (0, -1)]
while q:
x, y = q.pop(0)
for dx, dy in dirs:
nx, ny = x + dx, y + dy
if 0 <= nx < n and 0 <= ny < m and d[nx][ny] == -1 and g[nx][ny] != '*':
d[nx][ny] = d[x][y] + 1
q.append((nx, ny))
return d
def bfs_find_max_dist(g, n, m, d):
s = e = None
for i in range(n):
for j in range(m):
if g[i][j] == 'S': s = (i, j)
elif g[i][j] == 'E': e = (i, j)
if s is None or e is None: return 0
dist_from_S = [[-1] * m for _ in range(n)]
dist_from_S[s[0]][s[1]] = d[s[0]][s[1]]
q = [(s[0], s[1], d[s[0]][s[1]])]
max_min_dist = 0
while q:
x, y, min_dist = q.pop(0)
if (x, y) == e:
max_min_dist = max(max_min_dist, min_dist)
continue
for dx, dy in [(1, 0), (-1, 0), (0, 1), (0, -1)]:
nx, ny = x + dx, y + dy
if 0 <= nx < n and 0 <= ny < m and g[nx][ny] != '*':
new_min_dist = min(min_dist, d[nx][ny])
if dist_from_S[nx][ny] == -1:
dist_from_S[nx][ny] = new_min_dist
q.append((nx, ny, new_min_dist))
return max_min_dist
def findMaximumDistance(grid):
n, m = len(grid), len(grid[0])
dist_to_obstacles = bfs_from_obstacles(grid, n, m)
return bfs_find_max_dist(grid, n, m, dist_to_obstacles)
Ebullient โ
Maximum Distance
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
class Solution {
public:
vector<vector<long long>> dp;
long long solve(int node, int parent, int fact, vector<vector<int>>& adj, int k, vector<int>& coins) {
if (dp[node][fact] != -1)
return dp[node][fact];
long long currValue = coins[node] / pow(2, fact);
long long ansHalf = currValue / 2;
long long ansFull = currValue - k;
for (int child : adj[node]) {
if (child != parent) {
ansHalf += solve(child, node, fact >= 15 ? fact : fact + 1, adj, k, coins);
ansFull += solve(child, node, fact, adj, k, coins);
}
}
return dp[node][fact] = max(ansHalf, ansFull);
}
long long treePoints(int g_nodes, vector<int> g_from, vector<int> g_to, vector<int> A, int K) {
vector<vector<int>> adj(g_nodes);
for (size_t i = 0; i < g_from.size(); ++i) {
adj[g_from[i]].push_back(g_to[i]);
adj[g_to[i]].push_back(g_from[i]);
}
dp = vector<vector<long long>>(g_nodes, vector<long long>(16, -1));
return solve(0, -1, 0, adj, K, A);
}
};
Tree Value โ
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
#include <iostream> #include <vector> #include <cmath> #include <algorithm> using namespace std; class Solution { public: vector<vector<long long>> dp; long long solve(int node, int parent, int fact, vector<vector<int>>& adj, int k, vector<int>&โฆ
HPE โ
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
#include <iostream>
#include <vector>
#include <set>
#include <cmath>
#include <algorithm>
using namespace std;
vector<int> findPrimes(int limit) {
vector<int> primes;
vector<bool> sieve(limit + 1, true);
sieve[0] = sieve[1] = false;
for (int num = 2; num <= limit; ++num) {
if (sieve[num]) {
primes.push_back(num);
for (int multiple = num * num; multiple <= limit; multiple += num) {
sieve[multiple] = false;
}
}
}
return primes;
}
int dfs(int node, vector<vector<int>>& graph, vector<bool>& visited) {
visited[node] = true;
int size = 1;
for (int neighbor : graph[node]) {
if (!visited[neighbor]) {
size += dfs(neighbor, graph, visited);
}
}
return size;
}
int main() {
int N, M;
cin >> N >> M;
vector<vector<int>> graph(N + 1);
for (int i = 0; i < M; ++i) {
int U, V;
cin >> U >> V;
graph[U].push_back(V);
graph[V].push_back(U);
}
vector<bool> visited(N + 1, false);
int maxLandmarks = 0;
for (int i = 1; i <= N; ++i) {
if (!visited[i]) {
int size = dfs(i, graph, visited);
maxLandmarks = max(maxLandmarks, size);
}
}
vector<int> primes = findPrimes(1000);
int ticketPrice = primes[maxLandmarks - 1];
cout << maxLandmarks << " " << ticketPrice << endl;
return 0;
}
HP(Intern)โ
#include <iostream>
#include <string>
using namespace std;
string decodeWord(const string& word) {
string decoded = word;
int length = word.length();
for (int i = 0; i < length - 1; i += 2) {
swap(decoded[i], decoded[i + 1]);
}
return decoded;
}
int main() {
string word;
getline(cin, word);
string decodedWord = decodeWord(word);
cout << decodedWord << endl;
return 0;
}
HP(Intern)โ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Linkedin
#reactjs #nodejs #mernstack #fullstack #fulltime #mongodb | Dhwaj Gupta | 69 comments
Hiring Full Stack Developer!
Weโre Flabs, a fast-growing health tech company founded by IITians. If youโre passionate about tackling challenges, developing cutting-edge solutions, and looking to fast-track your career, this is the opportunity for you!
Location:โฆ
Weโre Flabs, a fast-growing health tech company founded by IITians. If youโre passionate about tackling challenges, developing cutting-edge solutions, and looking to fast-track your career, this is the opportunity for you!
Location:โฆ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐Atlan Is Hiring
Software Engineer - Intern
Remote Opportunity
Internship Duration: 6-month paid, full-time, remote internship.
- Applications Open: 4th October 2024.
- Applications Close: 7th October 2024.
๐ป Apply: https://jobs.lever.co/atlan/258b1aad-cef9-4f89-8c66-3aac988de02c
Software Engineer - Intern
Remote Opportunity
Internship Duration: 6-month paid, full-time, remote internship.
- Applications Open: 4th October 2024.
- Applications Close: 7th October 2024.
๐ป Apply: https://jobs.lever.co/atlan/258b1aad-cef9-4f89-8c66-3aac988de02c
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Linkedin
At BookingJini, we are looking for an enthusiastic and skilled AI/MLโฆ | Ramanujam Gond | 76 comments
At BookingJini, we are looking for an enthusiastic and skilled AI/ML Intern to join our growing team! If you are passionate about artificial intelligence, machine learning, and eager to work on impactful projects, we want to hear from you.
๐ What we're lookingโฆ
๐ What we're lookingโฆ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Linkedin
#internship #microsoft #referral #job #softwareengineer #career #fresherโฆ | Rajat Singhal | 32 comments
We are ๐ต๐ถ๐ฟ๐ถ๐ป๐ด for Software Engineering: Internship @ Microsoft !!!
๐๐ป๐๐ฒ๐ฟ๐ป๐๐ต๐ถ๐ฝ ๐๐ฒ๐๐ฎ๐ถ๐น๐:
Job Role: Software Engineering: Internship
Experience: Graduating in 2026 or later
Location: Multiple Locations, India
๐ฅ๐ฒ๐พ๐๐ถ๐ฟ๐ฒ๐ฑ ๐ค๐๐ฎ๐น๐ถ๐ณ๐ถ๐ฐ๐ฎ๐๐ถ๐ผ๐ป๐:
- Pursuing a bachelor'sโฆ
๐๐ป๐๐ฒ๐ฟ๐ป๐๐ต๐ถ๐ฝ ๐๐ฒ๐๐ฎ๐ถ๐น๐:
Job Role: Software Engineering: Internship
Experience: Graduating in 2026 or later
Location: Multiple Locations, India
๐ฅ๐ฒ๐พ๐๐ถ๐ฟ๐ฒ๐ฑ ๐ค๐๐ฎ๐น๐ถ๐ณ๐ถ๐ฐ๐ฎ๐๐ถ๐ผ๐ป๐:
- Pursuing a bachelor'sโฆ
private static long[] miniCost(int[] red, int[] blue, long blueCost) {
int n = red.length;
long[][] dp = new long[n + 1][2];
dp[0][0] = 0;
dp[0][1] = blueCost;
long[] ans = new long[n + 1];
for (int i = 1; i <= n; i++) {
dp[i][0] = Math.min(dp[i - 1][0] + red[i - 1], dp[i - 1][1] + red[i - 1]);
dp[i][1] = Math.min(dp[i - 1][1] + blue[i - 1], dp[i - 1][0] + blue[i - 1] + blueCost);
ans[i] = Math.min(dp[i][0], dp[i][1]);
}
return ans;
}
Visiting Cities
Patym โ
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
int maxTransactions(vector<int>& transactions) {
priority_queue<int, vector<int>, greater<int>> minHeap;
long long sum = 0;
int count = 0;
for (int i = 0; i < transactions.size(); i++) {
sum += transactions[i];
minHeap.push(transactions[i]);
if (sum < 0) {
int smallest = minHeap.top();
sum -= smallest;
minHeap.pop();
} else {
count++;
}
}
return count;
}
Bank Transactions โ
Patym
Capgemini Interview Experience
Self intro
Project explanation
More than five questions from project
What is SQL
Oops concepts fully explain
Data types
Local variable and global variable
Class and objective in python
Explain full join statement in SQL with example
How you take data of the student from student table based on some condition
How to convert string to integer
About python
Union and union all
What is your role in project
How did you clear error in your project
Difficulties in your project
What is your strength and weakness
How will you overcome your weakness
After five years in which technology you want to see your self
As a team leader what are the challenges you faced in your project
Suppose you are working in team facing challenges there is you have to alot work to some people will not aware of that work how will you handle this situation
Duration 30 minutes
Self intro
Project explanation
More than five questions from project
What is SQL
Oops concepts fully explain
Data types
Local variable and global variable
Class and objective in python
Explain full join statement in SQL with example
How you take data of the student from student table based on some condition
How to convert string to integer
About python
Union and union all
What is your role in project
How did you clear error in your project
Difficulties in your project
What is your strength and weakness
How will you overcome your weakness
After five years in which technology you want to see your self
As a team leader what are the challenges you faced in your project
Suppose you are working in team facing challenges there is you have to alot work to some people will not aware of that work how will you handle this situation
Duration 30 minutes
Capgemini Interview Experience
introduce yourself
what subjects you love
what is java
dbms
view
some more sql question
how you distribute task to project members
any question
introduce yourself
what subjects you love
what is java
dbms
view
some more sql question
how you distribute task to project members
any question