Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Company Name: IBM
Role: Associate Software Engineer
Batch eligible: 2022 and 2023 grads
Apply: https://careers.ibm.com/job/18844416/associate-systems-engineer-remote/
Role: Associate Software Engineer
Batch eligible: 2022 and 2023 grads
Apply: https://careers.ibm.com/job/18844416/associate-systems-engineer-remote/
#include <bits/stdc++.h>
using namespace std;
int main ()
{
int n; cin >> n;
vector<int> b(n), a;
for (auto & x : b) cin >> x;
int X; cin >> X;
for (int i = 0; i < X; i++) {
vector<int> newb(n);
for (int i = 0; i < n; i++) {
newb[i] = abs(b[i] - b[(i+1)%n]);
}
a = b;
b = newb;
}
cout << "A: ";
for (auto x : a) cout << x << " ";
cout << endl;
cout << "B: ";
for (auto x : b) cout << x << " ";
cout << endl;
}
Micron โ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Some Internship Opportunities!!
1) Rushan Corporation is hiring for Backend Developer Intern (2024 grads eligible)
Apply: https://bit.ly/45gassg
2) Reunion is hiring for FullStack Developer Internship (2024 grads eligible)
Apply: https://bit.ly/45lwFVI
3) Secure Blink is hiring for Backend Developer Internship (2024 and 2025 grads)
Apply: https://bit.ly/47g87iK
1) Rushan Corporation is hiring for Backend Developer Intern (2024 grads eligible)
Apply: https://bit.ly/45gassg
2) Reunion is hiring for FullStack Developer Internship (2024 grads eligible)
Apply: https://bit.ly/45lwFVI
3) Secure Blink is hiring for Backend Developer Internship (2024 and 2025 grads)
Apply: https://bit.ly/47g87iK
cuvette.tech
Backend Developer Internship in Rushan Corporation at Ahmedabad, Gujarat, India | Cuvette
Apply For Backend Developer Internship | Skills required are Spring Boot, Java | Stipend โน7K-9K | FULL-TIME INTERNSHIP | Location is Work from Home
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
AMD Hiring Intern !!
Batch: 2024
Stipend: 50k
Apply here-
https://globalcampus-amd.icims.com/jobs/33466/co-op--intern/job?mode=view&mobile=true&width=300&height=500&bga=true&needsRedirect=false&jan1offset=330&jun1offset=330
Batch: 2024
Stipend: 50k
Apply here-
https://globalcampus-amd.icims.com/jobs/33466/co-op--intern/job?mode=view&mobile=true&width=300&height=500&bga=true&needsRedirect=false&jan1offset=330&jun1offset=330
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
GitHub Education
https://education.github.com/campus_experts/
https://education.github.com/campus_experts/
GitHub
GitHub is where people build software. More than 150 million people use GitHub to discover, fork, and contribute to over 420 million projects.
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Company Name: LinkedIn
Role: SDE Intern
Batch eligible: 2025 grads only
Apply:
https://www.linkedin.com/jobs/view/3684489143
Role: SDE Intern
Batch eligible: 2025 grads only
Apply:
https://www.linkedin.com/jobs/view/3684489143
Linkedin
29 Software Engineer Intern jobs in India (2 new)
Todayโs top 29 Software Engineer Intern jobs in India. Leverage your professional network, and get hired. New Software Engineer Intern jobs added daily.
SinglyLinkedListNode* findLongestList(SinglyLinkedListNode* head) {
if (!head) return nullptr;
SinglyLinkedListNode* curr = head;
SinglyLinkedListNode* start = head;
SinglyLinkedListNode* bestStart = head;
int length = 1;
int bestLength = 1;
while (curr->next) {
if (curr->data >= curr->next->data) {
length++;
} else {
if (length > bestLength) {
bestLength = length;
bestStart = start;
}
length = 1;
start = curr->next;
}
curr = curr->next;
}
if (length > bestLength) {
bestLength = length;
bestStart = start;
}
SinglyLinkedListNode* temp = bestStart;
for (int i = 1; i < bestLength && temp; i++) {
temp = temp->next;
}
if (temp) {
temp->next = nullptr;
}
return bestStart;
}
Amazon OA| AWS Databased
C++โ
if (!head) return nullptr;
SinglyLinkedListNode* curr = head;
SinglyLinkedListNode* start = head;
SinglyLinkedListNode* bestStart = head;
int length = 1;
int bestLength = 1;
while (curr->next) {
if (curr->data >= curr->next->data) {
length++;
} else {
if (length > bestLength) {
bestLength = length;
bestStart = start;
}
length = 1;
start = curr->next;
}
curr = curr->next;
}
if (length > bestLength) {
bestLength = length;
bestStart = start;
}
SinglyLinkedListNode* temp = bestStart;
for (int i = 1; i < bestLength && temp; i++) {
temp = temp->next;
}
if (temp) {
temp->next = nullptr;
}
return bestStart;
}
Amazon OA| AWS Databased
C++โ
long findTotalExecutionTime(vector<int>& execution) {
int n = execution.size();
vector<int> original = execution;
long totalTime = 0;
unordered_map<int, list<int>> origIndicesMap;
for (int i = 0; i < n; i++) {
origIndicesMap[original[i]].push_back(i);
}
for (int i = 0; i < n; i++) {
totalTime += execution[i];
if (origIndicesMap[original[i]].size() > 1) {
int reducedValue = ceil((double)execution[i] / 2);
for (int idx : origIndicesMap[original[i]]) {
if (idx != i) {
execution[idx] = reducedValue;
}
}
}
}
return totalTime;
}
Amazon
C++ โ
int n = execution.size();
vector<int> original = execution;
long totalTime = 0;
unordered_map<int, list<int>> origIndicesMap;
for (int i = 0; i < n; i++) {
origIndicesMap[original[i]].push_back(i);
}
for (int i = 0; i < n; i++) {
totalTime += execution[i];
if (origIndicesMap[original[i]].size() > 1) {
int reducedValue = ceil((double)execution[i] / 2);
for (int idx : origIndicesMap[original[i]]) {
if (idx != i) {
execution[idx] = reducedValue;
}
}
}
}
return totalTime;
}
Amazon
C++ โ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Linkedin
iSteer hiring Data Scientist in Bengaluru, Karnataka, India | LinkedIn
Posted 5:27:11 AM. AppSteer is a cloud-native SaaS that empowers Organizations to rapidly create business applicationsโฆSee this and similar jobs on LinkedIn.
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Spring-works is Hiring !!
Role: iOS Developer
Experience: 0-1 Years
Stipend: 25K per Month
Location: Remote
Apply here- https://springrecruit.com/applynow/Springworks8989
Role: iOS Developer
Experience: 0-1 Years
Stipend: 25K per Month
Location: Remote
Apply here- https://springrecruit.com/applynow/Springworks8989
SpringRecruit
__OG_TITLE__
__OG_DESCRIPTION__
class Solution {
public:
bool isAnagram(string s, string t) {
sort(s.begin(), s.end());
sort(t.begin(), t.end());
return s == t;
}
};
int number = 15;
int n = (int)(log2(number));
// binary output
// using the inbuilt function
cout << "the binary number is : "
<< bitset<64>(number).to_string().substr(64 - n
- 1);
}
Slb solution โ
public:
bool isAnagram(string s, string t) {
sort(s.begin(), s.end());
sort(t.begin(), t.end());
return s == t;
}
};
int number = 15;
int n = (int)(log2(number));
// binary output
// using the inbuilt function
cout << "the binary number is : "
<< bitset<64>(number).to_string().substr(64 - n
- 1);
}
Slb solution โ
#include<bits/stdc++.h>
using namespace std;
int findMin(vector<int>& nums) {
int low = 0, high = nums.size() - 1, ans = INT_MAX;
while (low <= high) {
int mid = (low + high) / 2;
if (nums[low] <= nums[mid]) {
ans = std::min(ans, nums[low]);
low = mid + 1;
} else {
ans = std::min(ans, nums[mid]);
high = mid - 1;
}
}
return ans;
}
int main() {
int n;
cin >> n;
vector<int> nums(n);
for (int i = 0; i < n; ++i) {
cin >> nums[i];
}
int result = findMin(nums);
cout<< result << endl;
}
Helpshift โ
Ashley
using namespace std;
int findMin(vector<int>& nums) {
int low = 0, high = nums.size() - 1, ans = INT_MAX;
while (low <= high) {
int mid = (low + high) / 2;
if (nums[low] <= nums[mid]) {
ans = std::min(ans, nums[low]);
low = mid + 1;
} else {
ans = std::min(ans, nums[mid]);
high = mid - 1;
}
}
return ans;
}
int main() {
int n;
cin >> n;
vector<int> nums(n);
for (int i = 0; i < n; ++i) {
cin >> nums[i];
}
int result = findMin(nums);
cout<< result << endl;
}
Helpshift โ
Ashley
#include<iostream>
using namespace std;
int main() {
int sample;
cin >> sample;
for(int i = 0; i < sample; i++) {
int item;
cin >> item;
int count = 0;
while(item != 1) {
if(item % 2 == 0) {
item /= 2;
} else {
item -= 1;
}
count++;
}
cout <<count << endl;
}
return 0;
}
Multiplication tricks โ
Helpshift
using namespace std;
int main() {
int sample;
cin >> sample;
for(int i = 0; i < sample; i++) {
int item;
cin >> item;
int count = 0;
while(item != 1) {
if(item % 2 == 0) {
item /= 2;
} else {
item -= 1;
}
count++;
}
cout <<count << endl;
}
return 0;
}
Multiplication tricks โ
Helpshift
#include <bits/stdc++.h>
using namespace std;
int count(vector<int>&coins, int n, int sum)
{
int table[sum + 1];
memset(table, 0, sizeof(table));
table[0] = 1;
for (int i = 0; i < n; i++)
for (int j = coins[i]; j <= sum; j++)
table[j] += table[j - coins[i]];
return table[sum];
}
int main()
{
int n,t;
cin>>n>>t;
vector<int>L(t);
for(int i=0;i<t;i++)
{
cin>>L[i];
}
cout << count(L, t,n);
}
Helpshift โ
Goblin
using namespace std;
int count(vector<int>&coins, int n, int sum)
{
int table[sum + 1];
memset(table, 0, sizeof(table));
table[0] = 1;
for (int i = 0; i < n; i++)
for (int j = coins[i]; j <= sum; j++)
table[j] += table[j - coins[i]];
return table[sum];
}
int main()
{
int n,t;
cin>>n>>t;
vector<int>L(t);
for(int i=0;i<t;i++)
{
cin>>L[i];
}
cout << count(L, t,n);
}
Helpshift โ
Goblin
#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> getSkyline(vector<vector<int>>& buildings) {
vector<vector<int>> ans;
multiset<int> pq{0};
vector<pair<int, int>> points;
for(auto b: buildings){
points.push_back({b[0], -b[2]});
points.push_back({b[1], b[2]});
}
sort(points.begin(), points.end());
int ongoingHeight = 0;
for(int i = 0; i < points.size(); i++){
int currentPoint = points[i].first;
int heightAtCurrentPoint = points[i].second;
if(heightAtCurrentPoint < 0){
pq.insert(-heightAtCurrentPoint);
} else {
pq.erase(pq.find(heightAtCurrentPoint));
}
auto pqTop = *pq.rbegin();
if(ongoingHeight != pqTop){
ongoingHeight = pqTop;
ans.push_back({currentPoint, ongoingHeight});
}
}
return ans;
}
int main() {
int n;
cin >> n;
vector<vector<int>> buildings(n, vector<int>(3));
for (int i = 0; i < n; i++) {
for (int j = 0; j < 3; j++) {
cin >> buildings[i][j];
}
}
vector<vector<int>> result = getSkyline(buildings);
for (auto &p : result) {
cout << p[0]<<p[1]<< endl;
}
}
Skyline โ
using namespace std;
vector<vector<int>> getSkyline(vector<vector<int>>& buildings) {
vector<vector<int>> ans;
multiset<int> pq{0};
vector<pair<int, int>> points;
for(auto b: buildings){
points.push_back({b[0], -b[2]});
points.push_back({b[1], b[2]});
}
sort(points.begin(), points.end());
int ongoingHeight = 0;
for(int i = 0; i < points.size(); i++){
int currentPoint = points[i].first;
int heightAtCurrentPoint = points[i].second;
if(heightAtCurrentPoint < 0){
pq.insert(-heightAtCurrentPoint);
} else {
pq.erase(pq.find(heightAtCurrentPoint));
}
auto pqTop = *pq.rbegin();
if(ongoingHeight != pqTop){
ongoingHeight = pqTop;
ans.push_back({currentPoint, ongoingHeight});
}
}
return ans;
}
int main() {
int n;
cin >> n;
vector<vector<int>> buildings(n, vector<int>(3));
for (int i = 0; i < n; i++) {
for (int j = 0; j < 3; j++) {
cin >> buildings[i][j];
}
}
vector<vector<int>> result = getSkyline(buildings);
for (auto &p : result) {
cout << p[0]<<p[1]<< endl;
}
}
Skyline โ
#include <bits/stdc++.h>
using namespace std;
void minimumBribes(vector<int> A)
{
int n = A.size();
int cnt = 0;
for(int i = n - 1; i >= 0; i--)
{
if(A[i] != (i + 1))
{
if(((i - 1) >= 0) && A[i - 1] == (i + 1))
{
cnt++;
swap(A[i], A[i-1]);
}
else if(((i - 2) >= 0) && A[i - 2] == (i + 1))
{
cnt += 2;
A[i - 2] = A[i - 1];
A[i - 1] = A[i];
A[i] = i + 1;
}
else
{
cout << "Too chaotic" << endl;
return;
}
}
}
cout << cnt << endl;
return;
}
int main() {
int t;
cin >> t;
for (int i = 0; i < t; i++) {
int n;
cin >> n;
vector<int> A(n);
for (int j = 0; j < n; j++) {
cin >> A[j];
}
minimumBribes(A);
}
return 0;
}
Min bribes โ
using namespace std;
void minimumBribes(vector<int> A)
{
int n = A.size();
int cnt = 0;
for(int i = n - 1; i >= 0; i--)
{
if(A[i] != (i + 1))
{
if(((i - 1) >= 0) && A[i - 1] == (i + 1))
{
cnt++;
swap(A[i], A[i-1]);
}
else if(((i - 2) >= 0) && A[i - 2] == (i + 1))
{
cnt += 2;
A[i - 2] = A[i - 1];
A[i - 1] = A[i];
A[i] = i + 1;
}
else
{
cout << "Too chaotic" << endl;
return;
}
}
}
cout << cnt << endl;
return;
}
int main() {
int t;
cin >> t;
for (int i = 0; i < t; i++) {
int n;
cin >> n;
vector<int> A(n);
for (int j = 0; j < n; j++) {
cin >> A[j];
}
minimumBribes(A);
}
return 0;
}
Min bribes โ
#include<bits/stdc+.h>
using namespace std;
int main()
{
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++)cin>>a[i];
int next_greater[n], next_smaller[n];
stack<int> s1;
for ( int i=n-1; i>=0; i--)
{
while (!s1.empty() && a[s1.top()] <= a[i] )
s1.pop();
if (!s1.empty())
next_greater[i] = s1.top();
else
next_greater[i] = -1;
s1.push(i);
}
stack<int> s2;
for (int i=n-1; i>=0; i--)
{
while (!s2.empty() && a[s2.top()] >= a[i])
s2.pop();
if (!s2.empty())
next_smaller[i] = s2.top();
else
next_smaller[i] = -1;
s2.push(i);
}
for (int i=0; i< n; i++)
{
if (next_greater[i] != -1 && next_smaller[next_greater[i]] != -1)
cout << a[next_smaller[next_greater[i]]] <<" ";
else
cout<<-1<<" ";
}
}
Number games โ
using namespace std;
int main()
{
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++)cin>>a[i];
int next_greater[n], next_smaller[n];
stack<int> s1;
for ( int i=n-1; i>=0; i--)
{
while (!s1.empty() && a[s1.top()] <= a[i] )
s1.pop();
if (!s1.empty())
next_greater[i] = s1.top();
else
next_greater[i] = -1;
s1.push(i);
}
stack<int> s2;
for (int i=n-1; i>=0; i--)
{
while (!s2.empty() && a[s2.top()] >= a[i])
s2.pop();
if (!s2.empty())
next_smaller[i] = s2.top();
else
next_smaller[i] = -1;
s2.push(i);
}
for (int i=0; i< n; i++)
{
if (next_greater[i] != -1 && next_smaller[next_greater[i]] != -1)
cout << a[next_smaller[next_greater[i]]] <<" ";
else
cout<<-1<<" ";
}
}
Number games โ
public static int findBestPath(int n, int m, int max_t, List beauty, List u, List v, List t) {
// Write your code here
createGraph(n, m, u, v, t);
// int twoWay = dfs(0, beauty, max_t);
// visited = new HashSet<>();
// cycle(0, beauty, max_t, beauty.get(0), 0);
visited.add(0);
dfs2(0, beauty, max_t, beauty.get(0));
return totalAns;
}
static int totalAns = Integer.MIN_VALUE;
public static void dfs2(int node, List beauty, int maxT, int sum) {
if (node == 0) {
totalAns = Math.max(totalAns, sum);
}
for (int nbr : map.get(node).keySet()) {
int time = map.get(node).get(nbr);
if (time <= maxT) {
if (!visited.contains(nbr)) {
visited.add(nbr);
dfs2(nbr, beauty, maxT - time, sum + beauty.get(nbr));
visited.remove(nbr);
} else
dfs2(nbr, beauty, maxT - time, sum);
}
}
}
static HashSet<Integer> visited = new HashSet<>();
static HashMap<Integer, HashMap<Integer, Integer>> map = new HashMap<>();
public static void createGraph(int n, int m, List u, List v, List t) {
for (int i = 0; i < n; ++i) {
map.put(i, new HashMap<>());
}
for (int i = 0; i < m; ++i) {
int x = u.get(i);
int y = v.get(i);
int z = t.get(i);
map.get(x).put(y, z);
map.get(y).put(x, z);
}
}
Find best path
Linkedln โ
// Write your code here
createGraph(n, m, u, v, t);
// int twoWay = dfs(0, beauty, max_t);
// visited = new HashSet<>();
// cycle(0, beauty, max_t, beauty.get(0), 0);
visited.add(0);
dfs2(0, beauty, max_t, beauty.get(0));
return totalAns;
}
static int totalAns = Integer.MIN_VALUE;
public static void dfs2(int node, List beauty, int maxT, int sum) {
if (node == 0) {
totalAns = Math.max(totalAns, sum);
}
for (int nbr : map.get(node).keySet()) {
int time = map.get(node).get(nbr);
if (time <= maxT) {
if (!visited.contains(nbr)) {
visited.add(nbr);
dfs2(nbr, beauty, maxT - time, sum + beauty.get(nbr));
visited.remove(nbr);
} else
dfs2(nbr, beauty, maxT - time, sum);
}
}
}
static HashSet<Integer> visited = new HashSet<>();
static HashMap<Integer, HashMap<Integer, Integer>> map = new HashMap<>();
public static void createGraph(int n, int m, List u, List v, List t) {
for (int i = 0; i < n; ++i) {
map.put(i, new HashMap<>());
}
for (int i = 0; i < m; ++i) {
int x = u.get(i);
int y = v.get(i);
int z = t.get(i);
map.get(x).put(y, z);
map.get(y).put(x, z);
}
}
Find best path
Linkedln โ
int getMinimumCost(vector<int> arr)
{
long long maxDiff = 0 ;
int index = -1 ;
for(int i= 0 ; i < arr.size()-1 ; i++)
{
if(abs(arr[i]-arr[i+1]) > maxDiff)
{
maxDiff = abs(arr[i]-arr[i+1]) ;
index = i ;
}
}
int median = (arr[index] + arr[index+1]) / 2 ;
long long initialCost = 0 ;
for(int i= 0 ; i < arr.size()-1 ; i++)
initialCost += pow(arr[i]-arr[i+1],2) ;
initialCost = initialCost + pow(arr[index] - median,2) + pow(median - arr[index+1],2) - pow(arr[index] - arr[index+1] ,2) ;
return initialCost ;
}
Linkedln โ
{
long long maxDiff = 0 ;
int index = -1 ;
for(int i= 0 ; i < arr.size()-1 ; i++)
{
if(abs(arr[i]-arr[i+1]) > maxDiff)
{
maxDiff = abs(arr[i]-arr[i+1]) ;
index = i ;
}
}
int median = (arr[index] + arr[index+1]) / 2 ;
long long initialCost = 0 ;
for(int i= 0 ; i < arr.size()-1 ; i++)
initialCost += pow(arr[i]-arr[i+1],2) ;
initialCost = initialCost + pow(arr[index] - median,2) + pow(median - arr[index+1],2) - pow(arr[index] - arr[index+1] ,2) ;
return initialCost ;
}
Linkedln โ
Tomorrow Anyone Give Exam IBM OA?