๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
class Dice {
public:
int t, b, l, r, f, k;
Dice() {
t = 1; b = 6; l = 4; r = 3; f = 2; k = 5;
}
void rollRight() {
int temp = t;
t = l;
l = b;
b = r;
r = temp;
}
void rollLeft() {
int temp = t;
t = r;
r = b;
b = l;
l = temp;
}
void rollDown() {
int temp = t;
t = k;
k = b;
b = f;
f = temp;
}
};
int calculateCubeSum(int R, int C) {
Dice dice;
int s = 0;
for (int i = 0; i < R; ++i) {
if (i % 2 == 0) {
for (int j = 0; j < C; ++j) {
s += dice.t;
if (j < C - 1) dice.rollRight();
}
} else {
for (int j = C - 1; j >= 0; --j) {
s += dice.t;
if (j > 0) dice.rollLeft();
}
}
if (i < R - 1) dice.rollDown();
}
return s;
}
Rolling a Dice โ
Goldman Sachs
public:
int t, b, l, r, f, k;
Dice() {
t = 1; b = 6; l = 4; r = 3; f = 2; k = 5;
}
void rollRight() {
int temp = t;
t = l;
l = b;
b = r;
r = temp;
}
void rollLeft() {
int temp = t;
t = r;
r = b;
b = l;
l = temp;
}
void rollDown() {
int temp = t;
t = k;
k = b;
b = f;
f = temp;
}
};
int calculateCubeSum(int R, int C) {
Dice dice;
int s = 0;
for (int i = 0; i < R; ++i) {
if (i % 2 == 0) {
for (int j = 0; j < C; ++j) {
s += dice.t;
if (j < C - 1) dice.rollRight();
}
} else {
for (int j = C - 1; j >= 0; --j) {
s += dice.t;
if (j > 0) dice.rollLeft();
}
}
if (i < R - 1) dice.rollDown();
}
return s;
}
Rolling a Dice โ
Goldman Sachs
โค1
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
void displayTheChannel(int N, vector<string>& channels, vector<int>& operations) {
int i = 0;
for (auto op : operations) {
if (op == 1) {
if (i < N - 1) {
swap(channels[i], channels[i + 1]);
i++;
}
} else if (op == 2) {
if (i > 0) {
swap(channels[i], channels[i - 1]);
i--;
}
} else if (op == 3) {
if (i < N - 1) {
swap(channels[i], channels[i + 1]);
i++;
}
}
}
for (const auto& channel : channels) {
cout << channel << endl;
}
}
int main() {
int N;
cin >> N; // Number of channels
vector<string> channels(N);
for (int i = 0; i < N; ++i) {
cin >> channels[i];
}
int M;
cin >> M;
vector<int> operations(M);
for (int i = 0; i < M; ++i) {
cin >> operations[i];
}
displayTheChannel(N, channels, operations);
return 0;
}
// CHANNEL SEQUENCE โ
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
void displayTheChannel(int N, vector<string>& channels, vector<int>& operations) {
int i = 0;
for (auto op : operations) {
if (op == 1) {
if (i < N - 1) {
swap(channels[i], channels[i + 1]);
i++;
}
} else if (op == 2) {
if (i > 0) {
swap(channels[i], channels[i - 1]);
i--;
}
} else if (op == 3) {
if (i < N - 1) {
swap(channels[i], channels[i + 1]);
i++;
}
}
}
for (const auto& channel : channels) {
cout << channel << endl;
}
}
int main() {
int N;
cin >> N; // Number of channels
vector<string> channels(N);
for (int i = 0; i < N; ++i) {
cin >> channels[i];
}
int M;
cin >> M;
vector<int> operations(M);
for (int i = 0; i < M; ++i) {
cin >> operations[i];
}
displayTheChannel(N, channels, operations);
return 0;
}
// CHANNEL SEQUENCE โ
๐1
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
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 โ