๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
#include <iostream>
#include <vector>
#include <sstream>
#include <unordered_map>
using namespace std;
void generateResult(int N, int M, vector<string>& employeeSalaryAndSuperior, vector<string>& operations) {
vector<int> salaries(N, 0);
unordered_map<int, vector<int>> supervisors;
for (int i = 0; i < N; ++i) {
stringstream ss(employeeSalaryAndSuperior[i]);
int salary, supervisor;
ss >> salary >> supervisor;
salaries[i] = salary;
if (supervisor != -1) {
supervisors[supervisor - 1].push_back(i);
}
}
for (int i = 0; i < M; ++i) {
stringstream ss(operations[i]);
char type;
ss >> type;
if (type == 'p') {
int A, X;
ss >> A >> X;
A -= 1;
for (int subordinate : supervisors[A]) {
salaries[subordinate] += X;
}
} else if (type == 'u') {
int B;
ss >> B;
B -= 1;
cout << salaries[B] << endl;
}
}
}
int main() {
int N, M;
cin >> N >> M;
cin.ignore();
vector<string> employeeSalaryAndSuperior(N);
for (int i = 0; i < N; ++i) {
getline(cin, employeeSalaryAndSuperior[i]);
}
vector<string> operations(M);
for (int i = 0; i < M; ++i) {
getline(cin, operations[i]);
}
generateResult(N, M, employeeSalaryAndSuperior, operations);
return 0;
}
Salary fluctuations โ
#include <vector>
#include <sstream>
#include <unordered_map>
using namespace std;
void generateResult(int N, int M, vector<string>& employeeSalaryAndSuperior, vector<string>& operations) {
vector<int> salaries(N, 0);
unordered_map<int, vector<int>> supervisors;
for (int i = 0; i < N; ++i) {
stringstream ss(employeeSalaryAndSuperior[i]);
int salary, supervisor;
ss >> salary >> supervisor;
salaries[i] = salary;
if (supervisor != -1) {
supervisors[supervisor - 1].push_back(i);
}
}
for (int i = 0; i < M; ++i) {
stringstream ss(operations[i]);
char type;
ss >> type;
if (type == 'p') {
int A, X;
ss >> A >> X;
A -= 1;
for (int subordinate : supervisors[A]) {
salaries[subordinate] += X;
}
} else if (type == 'u') {
int B;
ss >> B;
B -= 1;
cout << salaries[B] << endl;
}
}
}
int main() {
int N, M;
cin >> N >> M;
cin.ignore();
vector<string> employeeSalaryAndSuperior(N);
for (int i = 0; i < N; ++i) {
getline(cin, employeeSalaryAndSuperior[i]);
}
vector<string> operations(M);
for (int i = 0; i < M; ++i) {
getline(cin, operations[i]);
}
generateResult(N, M, employeeSalaryAndSuperior, operations);
return 0;
}
Salary fluctuations โ
๐1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Salesforce is hiring Software Engineer Intern
50 - 65 k per month
2025 batch eligible
https://salesforce.wd12.myworkdayjobs.com/en-US/External_Career_Site/job/Intern_JR250704?s=08
Salesforce is hiring for Interns
2026 Passout
To get Referral follow these steps
In "How Did You Hear About Us" question
Select Referral and enter my Email s.sarkar@salesforce.com
50 - 65 k per month
2025 batch eligible
https://salesforce.wd12.myworkdayjobs.com/en-US/External_Career_Site/job/Intern_JR250704?s=08
Salesforce is hiring for Interns
2026 Passout
To get Referral follow these steps
In "How Did You Hear About Us" question
Select Referral and enter my Email s.sarkar@salesforce.com
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Company: Qualcomm
Location: Hyderabad
Role: SDE (Embedded Software)
For Graduates: 2022, 2023, 2024
https://www.linkedin.com/posts/soumen-ghosh-a1a958128_new-job-opening-at-qualcomm-below-activity-7218299548882849793-nzlO
Location: Hyderabad
Role: SDE (Embedded Software)
For Graduates: 2022, 2023, 2024
https://www.linkedin.com/posts/soumen-ghosh-a1a958128_new-job-opening-at-qualcomm-below-activity-7218299548882849793-nzlO
Linkedin
New Job Opening at Qualcomm!!๐จโ๐ป
Below are the basic details about theโฆ | Soumen Ghosh | 66 comments
Below are the basic details about theโฆ | Soumen Ghosh | 66 comments
New Job Opening at Qualcomm!!๐จโ๐ป
Below are the basic details about the current opening in my team.
Job location: Hyderabad
Requirements:
โ 0-4 years of work experience
โ Proficiency in C/C++
If you are interested to work in Embedded Software domain thenโฆ
Below are the basic details about the current opening in my team.
Job location: Hyderabad
Requirements:
โ 0-4 years of work experience
โ Proficiency in C/C++
If you are interested to work in Embedded Software domain thenโฆ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Company: WeCP
Location: N/A
Role: SDE
For Graduates: 2024, 2023, 2022, 2021
https://assess.wecreateproblems.com/tests/147ea977-7bd5-48a3-96d3-fd9c609278fa/instructions
Location: N/A
Role: SDE
For Graduates: 2024, 2023, 2022, 2021
https://assess.wecreateproblems.com/tests/147ea977-7bd5-48a3-96d3-fd9c609278fa/instructions
Wecreateproblems
Spot talent worth betting on: WeCP
WeCP Assessment Software. Discover and Develop Tech Talents at Scale. Experience your tech assessment and training with phenomenal business growth.
๐1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Interactive Brokers is hiring for Junior Software Engineer- Freshers (2024)
Experience: 0 - 1 year's
Expected Salary: 9 - 15 LPA
Apply here:
https://boards.greenhouse.io/ibkr/jobs/7524334002?gh_src=19375022
Experience: 0 - 1 year's
Expected Salary: 9 - 15 LPA
Apply here:
https://boards.greenhouse.io/ibkr/jobs/7524334002?gh_src=19375022
job-boards.greenhouse.io
Interactive Brokers
<p><span data-preserver-spaces="true">Interactive Brokers Group, Inc. (NASDAQ: "IBKR"); is a direct access electronic broker catering to the needs of professional and frequent traders, institutional investors, financial advisers, and introducing brokers.โฆ
๐2
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Infoane is hiring for Software Engineer
Walkin Drive on 20 July 2024
Batch : 2024/2023 passouts eligible
Apply Here :
https://docs.google.com/forms/d/e/1FAIpQLSf7pqYTBC-SnKR5wvJysHYyLlfEXX35KuE9wcn35k554_JEgQ/viewform?pli=1
Walkin Drive on 20 July 2024
Batch : 2024/2023 passouts eligible
Apply Here :
https://docs.google.com/forms/d/e/1FAIpQLSf7pqYTBC-SnKR5wvJysHYyLlfEXX35KuE9wcn35k554_JEgQ/viewform?pli=1
Google Docs
Infoane Technologies - Trainee Software Engineer - July 20, 2024
Position: Trainee Software Engineer (Freshers)
Work location: Kovilpatti, Tamil Nadu
Education:
B.E/Btech/Mtech/MCA - CSE/IT/ECE/EEE
Above 60%+ in all academics
Mandatory:
Must carry all original certificates to the interview and a copy of profileโฆ
Work location: Kovilpatti, Tamil Nadu
Education:
B.E/Btech/Mtech/MCA - CSE/IT/ECE/EEE
Above 60%+ in all academics
Mandatory:
Must carry all original certificates to the interview and a copy of profileโฆ
def bird_nest(forest, bird):
nest = []
total_length = 0
direction = 1
current_position = bird
visited = set()
while total_length < 100:
while forest[current_position] == 0 or current_position in visited:
current_position += direction
nest.append(current_position)
total_length += forest[current_position]
visited.add(current_position)
current_position = bird
direction *= -1
return nest
Databrick โ
nest = []
total_length = 0
direction = 1
current_position = bird
visited = set()
while total_length < 100:
while forest[current_position] == 0 or current_position in visited:
current_position += direction
nest.append(current_position)
total_length += forest[current_position]
visited.add(current_position)
current_position = bird
direction *= -1
return nest
Databrick โ
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
List<Integer> results = new ArrayList<>();
int counter = 1;
Map<Integer, Integer> allocationMap = new HashMap<>();
for (int[] query : queries) {
if (query[0] == 0) {
int length = query[1];
int result = -1;
for (int i = 0; i <= memory.length - length; i++) {
boolean canAllocate = true;
for (int j = 0; j < length; j++) {
if (memory[i + j] != 0) {
canAllocate = false;
break;
}
}
if (canAllocate) {
for (int j = 0; j < length; j++) {
memory[i + j] = counter;
}
allocationMap.put(counter, length);
result = counter++;
break;
}
}
results.add(result);
} else if (query[0] == 1) {
int id = query[1];
if (!allocationMap.containsKey(id)) {
results.add(-1);
continue;
}
int length = allocationMap.get(id);
boolean erased = false;
for (int i = 0; i < memory.length; i++) {
if (memory[i] == id) {
for (int j = 0; j < length; j++) {
memory[i + j] = 0;
}
allocationMap.remove(id);
results.add(length);
erased = true;
break;
}
}
if (!erased) {
results.add(-1);
}
}
}
int[] resultArray = new int[results.size()];
for (int i = 0; i < results.size(); i++) {
resultArray[i] = results.get(i);
}
return resultArray;
}
int counter = 1;
Map<Integer, Integer> allocationMap = new HashMap<>();
for (int[] query : queries) {
if (query[0] == 0) {
int length = query[1];
int result = -1;
for (int i = 0; i <= memory.length - length; i++) {
boolean canAllocate = true;
for (int j = 0; j < length; j++) {
if (memory[i + j] != 0) {
canAllocate = false;
break;
}
}
if (canAllocate) {
for (int j = 0; j < length; j++) {
memory[i + j] = counter;
}
allocationMap.put(counter, length);
result = counter++;
break;
}
}
results.add(result);
} else if (query[0] == 1) {
int id = query[1];
if (!allocationMap.containsKey(id)) {
results.add(-1);
continue;
}
int length = allocationMap.get(id);
boolean erased = false;
for (int i = 0; i < memory.length; i++) {
if (memory[i] == id) {
for (int j = 0; j < length; j++) {
memory[i + j] = 0;
}
allocationMap.remove(id);
results.add(length);
erased = true;
break;
}
}
if (!erased) {
results.add(-1);
}
}
}
int[] resultArray = new int[results.size()];
for (int i = 0; i < results.size(); i++) {
resultArray[i] = results.get(i);
}
return resultArray;
}
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
def find_local_maxima(matrix):
def is_local_maximum(matrix, i, j):
val = matrix[i][j]
if val == 0:
return False
for di in [-1, 0, 1]:
for dj in [-1, 0, 1]:
if di == 0 and dj == 0:
continue
ni, nj = i + di, j + dj
if 0 <= ni < len(matrix) and 0 <= nj < len(matrix[0]):
if matrix[ni][nj] >= val:
return False
return True
local_maxima = []
for i in range(len(matrix)):
for j in range(len(matrix[0])):
if is_local_maximum(matrix, i, j):
local_maxima.append((i, j))
return local_maxima[:2]
def is_local_maximum(matrix, i, j):
val = matrix[i][j]
if val == 0:
return False
for di in [-1, 0, 1]:
for dj in [-1, 0, 1]:
if di == 0 and dj == 0:
continue
ni, nj = i + di, j + dj
if 0 <= ni < len(matrix) and 0 <= nj < len(matrix[0]):
if matrix[ni][nj] >= val:
return False
return True
local_maxima = []
for i in range(len(matrix)):
for j in range(len(matrix[0])):
if is_local_maximum(matrix, i, j):
local_maxima.append((i, j))
return local_maxima[:2]
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
int solution(vector<int>& A, vector<int>& B) {
int n = A.size();
vector<vector<int>> graph(n + 1);
vector<bool> visited(n + 1, false);
int count = 0;
unordered_map<string, int> directions;
for (int i = 0; i < n; ++i) {
graph[A[i]].push_back(B[i]);
graph[B[i]].push_back(A[i]);
string directionKey = to_string(A[i]) + "->" + to_string(B[i]);
directions[directionKey] = 0;
}
function<void(int)> dfs = [&](int city) {
visited[city] = true;
for (int neighbor : graph[city]) {
if (visited[neighbor]) {
continue;
}
string changedDirectionKey = to_string(neighbor) + "->" + to_string(city);
if (directions.find(changedDirectionKey) == directions.end()) {
count++;
}
dfs(neighbor);
}
};
dfs(0);
return count;
}
int n = A.size();
vector<vector<int>> graph(n + 1);
vector<bool> visited(n + 1, false);
int count = 0;
unordered_map<string, int> directions;
for (int i = 0; i < n; ++i) {
graph[A[i]].push_back(B[i]);
graph[B[i]].push_back(A[i]);
string directionKey = to_string(A[i]) + "->" + to_string(B[i]);
directions[directionKey] = 0;
}
function<void(int)> dfs = [&](int city) {
visited[city] = true;
for (int neighbor : graph[city]) {
if (visited[neighbor]) {
continue;
}
string changedDirectionKey = to_string(neighbor) + "->" + to_string(city);
if (directions.find(changedDirectionKey) == directions.end()) {
count++;
}
dfs(neighbor);
}
};
dfs(0);
return count;
}
โค1
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
vector<int> row, col;
void dfs(vector<vector<int>>& matrix, vector<vector<bool>>& visited, int x, int y)
{
int rows = matrix.size();
int cols = matrix[0].size();
visited[x][y] = true;
for (int k = 0; k < row.size(); ++k)
{
int newX = x + row[k];
int newY = y + col[k];
if (newX >= 0 && newX < rows && newY >= 0 && newY < cols && matrix[newX][newY] == 1 && !visited[newX][newY])
{
dfs(matrix, visited, newX, newY);
}
}
}
int hello(vector<vector<int>>& matrix, int adj)
{
int rows = matrix.size();
int cols = matrix[0].size();
vector<vector<bool>> visited(rows, vector<bool>(cols, false));
int count = 0;
for (int i = 0; i < rows; ++i)
{
for (int j = 0; j < cols; ++j)
{
if (matrix[i][j] == 1 && !visited[i][j])
{
count++;
dfs(matrix, visited, i, j);
}
}
}
return count;
}
int main() {
int adj, rows, cols;
cin >> adj;
cin >> rows >> cols;
vector<vector<int>> matrix(rows, vector<int>(cols));
for (int i = 0; i < rows; ++i) {
for (int j = 0; j < cols; ++j) {
cin >> matrix[i][j];
}
}
if (adj == 1) {
row = {0, 0};
col = {-1, 1};
} else if (adj == 2) {
row = {-1, 1};
col = {0, 0};
} else if (adj == 3) {
row = {-1, -1, 1, 1};
col = {-1, 1, -1, 1};
} else if (adj == 4) {
row = {0, 0, -1, 1};
col = {-1, 1, 0, 0};
} else if (adj == 5) {
row = {-1, -1, -1, 0, 0, 1, 1, 1};
col = {-1, 0, 1, -1, 1, -1, 0, 1};
}
int result = hello(matrix, adj);
cout << result << endl;
return 0;
}
HPC programming โ
#include <vector>
#include <queue>
using namespace std;
vector<int> row, col;
void dfs(vector<vector<int>>& matrix, vector<vector<bool>>& visited, int x, int y)
{
int rows = matrix.size();
int cols = matrix[0].size();
visited[x][y] = true;
for (int k = 0; k < row.size(); ++k)
{
int newX = x + row[k];
int newY = y + col[k];
if (newX >= 0 && newX < rows && newY >= 0 && newY < cols && matrix[newX][newY] == 1 && !visited[newX][newY])
{
dfs(matrix, visited, newX, newY);
}
}
}
int hello(vector<vector<int>>& matrix, int adj)
{
int rows = matrix.size();
int cols = matrix[0].size();
vector<vector<bool>> visited(rows, vector<bool>(cols, false));
int count = 0;
for (int i = 0; i < rows; ++i)
{
for (int j = 0; j < cols; ++j)
{
if (matrix[i][j] == 1 && !visited[i][j])
{
count++;
dfs(matrix, visited, i, j);
}
}
}
return count;
}
int main() {
int adj, rows, cols;
cin >> adj;
cin >> rows >> cols;
vector<vector<int>> matrix(rows, vector<int>(cols));
for (int i = 0; i < rows; ++i) {
for (int j = 0; j < cols; ++j) {
cin >> matrix[i][j];
}
}
if (adj == 1) {
row = {0, 0};
col = {-1, 1};
} else if (adj == 2) {
row = {-1, 1};
col = {0, 0};
} else if (adj == 3) {
row = {-1, -1, 1, 1};
col = {-1, 1, -1, 1};
} else if (adj == 4) {
row = {0, 0, -1, 1};
col = {-1, 1, 0, 0};
} else if (adj == 5) {
row = {-1, -1, -1, 0, 0, 1, 1, 1};
col = {-1, 0, 1, -1, 1, -1, 0, 1};
}
int result = hello(matrix, adj);
cout << result << endl;
return 0;
}
HPC programming โ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐1
s = [0]
def mapper(b):
num_dict = {0: 1, 1: 2, 2: 0}
return num_dict[b]
class tmap:
def __init__(self, fun, s):
self.fun = fun
self.list = s
self.cachedlen = len(self.list)
def __getitem__(self, i):
return self.fun(self.list[i])
def __len__(self):
return self.cachedlen
class concat:
def __init__(self, s1):
self.s1 = s1
self.s2 = tmap(mapper, self.s1)
self.cachedlen = len(s1) * 2
def __getitem__(self, i):
if i < len(self.s1):
return self.s1[i]
else:
return self.s2[i - len(self.s1)]
def __len__(self):
return self.cachedlen
for i in range(30):
s = concat(s)
# Use s[n] to obtain the n-th number in the sequence
print(len(s))
Who have Uber, Sprinklr, DE Shaw exam guys?
Send questions here solutions will be provide
Send questions here solutions will be provide
๐3
def solve(N, M, A):
from functools import lru_cache
import sys
@lru_cache(None)
def dp(mask):
if mask == 0:
return 0
res = sys.maxsize
for i in range(N):
if mask & (1 << i):
for j in range(M):
res = min(res, A[i][j] | dp(mask ^ (1 << i)))
return res
full_mask = (1 << N) - 1
return dp(full_mask)
# Input reading
if name == "main":
import sys
input = sys.stdin.read
data = input().split()
N = int(data[0])
M = int(data[1])
A = []
idx = 2
for i in range(N):
A.append(list(map(int, data[idx:idx + M])))
idx += M
print(solve(N, M, A))
Minimum possible sum โ
from functools import lru_cache
import sys
@lru_cache(None)
def dp(mask):
if mask == 0:
return 0
res = sys.maxsize
for i in range(N):
if mask & (1 << i):
for j in range(M):
res = min(res, A[i][j] | dp(mask ^ (1 << i)))
return res
full_mask = (1 << N) - 1
return dp(full_mask)
# Input reading
if name == "main":
import sys
input = sys.stdin.read
data = input().split()
N = int(data[0])
M = int(data[1])
A = []
idx = 2
for i in range(N):
A.append(list(map(int, data[idx:idx + M])))
idx += M
print(solve(N, M, A))
Minimum possible sum โ