#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main() {
string str;
cin >> str;
vector<int> count(26, 0); // Initialize count for each alphabet letter to 0
for (int i = 0; i < str.size(); i++) {
int index = str[i] - 'a'; // Convert character to corresponding index in count array
cout << str[i] << ":" << count[index] << " ";
cout<<endl;// Output letter and its count
count[index]++; // Increment count for current letter
}
return 0;
}
Hacks on Amazon โ
#include <vector>
#include <string>
using namespace std;
int main() {
string str;
cin >> str;
vector<int> count(26, 0); // Initialize count for each alphabet letter to 0
for (int i = 0; i < str.size(); i++) {
int index = str[i] - 'a'; // Convert character to corresponding index in count array
cout << str[i] << ":" << count[index] << " ";
cout<<endl;// Output letter and its count
count[index]++; // Increment count for current letter
}
return 0;
}
Hacks on Amazon โ
๐2
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Swish Club is hiring Product Management Intern
For 2024 grads
Check out this job at Swish Club: https://www.linkedin.com/jobs/view/3936821216
For 2024 grads
Check out this job at Swish Club: https://www.linkedin.com/jobs/view/3936821216
Linkedin
Swish Club hiring Product Management Intern in Bengaluru, Karnataka, India | LinkedIn
Posted 12:24:02 PM. ๐ Hiring for Product Interns! ๐ About the Companyโ Swish Club is India's first "Employee Savingsโฆ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)
Victoria's Secret and Co is hiring Associate Software Engineer
Location - Bangalore
For 2023, 2022 grads
https://careers.victoriassecret.com/job-2/20193431
Location - Bangalore
For 2023, 2022 grads
https://careers.victoriassecret.com/job-2/20193431
Victoriaโs Secret Careers
Victoriaโs Secret - Job Description
Learn more about this particular Victoriaโs Secret role and others similar to it today.
๐1
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
#include <climits>
using namespace std;
vector<int> dijkstra(int start, int end, const vector<vector<int>>& graph, int N) {
vector<int> dist(N + 1, INT_MAX);
dist[start] = 0;
priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> pq;
pq.push({0, start});
while (!pq.empty()) {
int d = pq.top().first;
int u = pq.top().second;
pq.pop();
if (d > dist[u]) continue;
for (int v : graph[u]) {
if (dist[u] + 1 < dist[v]) {
dist[v] = dist[u] + 1;
pq.push({dist[v], v});
}
}
}
return dist;
}
vector<int> solution(const vector<int>& A, const vector<int>& B, int N) {
vector<vector<int>> graph(N + 1);
for (int i = 1; i < N; ++i) {
graph[i].push_back(i + 1);
graph[i + 1].push_back(i);
}
vector<int> initial_dist = dijkstra(1, N, graph, N);
vector<int> results;
for (int i = 0; i < A.size(); ++i) {
graph[A[i]].push_back(B[i]);
graph[B[i]].push_back(A[i]);
vector<int> new_dist = dijkstra(1, N, graph, N);
results.push_back(new_dist[N]);
}
return results;
}
Hashedin โ
#include <vector>
#include <queue>
#include <unordered_map>
#include <climits>
using namespace std;
vector<int> dijkstra(int start, int end, const vector<vector<int>>& graph, int N) {
vector<int> dist(N + 1, INT_MAX);
dist[start] = 0;
priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> pq;
pq.push({0, start});
while (!pq.empty()) {
int d = pq.top().first;
int u = pq.top().second;
pq.pop();
if (d > dist[u]) continue;
for (int v : graph[u]) {
if (dist[u] + 1 < dist[v]) {
dist[v] = dist[u] + 1;
pq.push({dist[v], v});
}
}
}
return dist;
}
vector<int> solution(const vector<int>& A, const vector<int>& B, int N) {
vector<vector<int>> graph(N + 1);
for (int i = 1; i < N; ++i) {
graph[i].push_back(i + 1);
graph[i + 1].push_back(i);
}
vector<int> initial_dist = dijkstra(1, N, graph, N);
vector<int> results;
for (int i = 0; i < A.size(); ++i) {
graph[A[i]].push_back(B[i]);
graph[B[i]].push_back(A[i]);
vector<int> new_dist = dijkstra(1, N, graph, N);
results.push_back(new_dist[N]);
}
return results;
}
Hashedin โ
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
#include <vector>
#include <iostream>
#include <algorithm>
#include <climits>
using namespace std;
int solution(vector<vector<int>>& chessboard) {
int N = chessboard.size();
vector<vector<pair<int, int>>> topTwoMax(N, vector<pair<int, int>>(2, {0, -1}));
for (int i = 0; i < N; ++i) {
int max1 = INT_MIN, max2 = INT_MIN;
int idx1 = -1, idx2 = -1;
for (int j = 0; j < chessboard[i].size(); ++j) {
if (chessboard[i][j] >= max1) {
max2 = max1;
idx2 = idx1;
max1 = chessboard[i][j];
idx1 = j;
} else if (chessboard[i][j] > max2) {
max2 = chessboard[i][j];
idx2 = j;
}
}
topTwoMax[i][0] = {max1, idx1};
topTwoMax[i][1] = {max2, idx2};
}
int maxSum = 0;
for (int i = 0; i < N; ++i) {
for (int j = i + 1; j < N; ++j) {
int sum = topTwoMax[i][0].first + topTwoMax[j][0].first;
if (topTwoMax[i][0].second != topTwoMax[j][0].second) {
maxSum = max(maxSum, sum);
} else {
sum = max(topTwoMax[i][0].first + topTwoMax[j][1].first,
topTwoMax[i][1].first + topTwoMax[j][0].first);
maxSum = max(maxSum, sum);
}
}
}
return maxSum;
}
#include <iostream>
#include <algorithm>
#include <climits>
using namespace std;
int solution(vector<vector<int>>& chessboard) {
int N = chessboard.size();
vector<vector<pair<int, int>>> topTwoMax(N, vector<pair<int, int>>(2, {0, -1}));
for (int i = 0; i < N; ++i) {
int max1 = INT_MIN, max2 = INT_MIN;
int idx1 = -1, idx2 = -1;
for (int j = 0; j < chessboard[i].size(); ++j) {
if (chessboard[i][j] >= max1) {
max2 = max1;
idx2 = idx1;
max1 = chessboard[i][j];
idx1 = j;
} else if (chessboard[i][j] > max2) {
max2 = chessboard[i][j];
idx2 = j;
}
}
topTwoMax[i][0] = {max1, idx1};
topTwoMax[i][1] = {max2, idx2};
}
int maxSum = 0;
for (int i = 0; i < N; ++i) {
for (int j = i + 1; j < N; ++j) {
int sum = topTwoMax[i][0].first + topTwoMax[j][0].first;
if (topTwoMax[i][0].second != topTwoMax[j][0].second) {
maxSum = max(maxSum, sum);
} else {
sum = max(topTwoMax[i][0].first + topTwoMax[j][1].first,
topTwoMax[i][1].first + topTwoMax[j][0].first);
maxSum = max(maxSum, sum);
}
}
}
return maxSum;
}
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Thomson Reuters is hiring SDE Intern
For 2024, 2025 grads
https://careers.thomsonreuters.com/us/en/job/THTTRUUSJREQ178337EXTERNALENUS/Software-Engineering-Internship
https://careers.thomsonreuters.com/us/en/job/THTTRUUSJREQ178337EXTERNALENUS/Software-Engineering-Internship
๐1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
In case youโre from Delhi NCR (2023 and 2024 grads)
Accenture Interview Experience :
Introduction
Hobbies
Talk on virat Kohli
Chees
Programming language
Oops
C++ and java difference
Why Accenture
Project
Your role
Technology
Strength
Weakness
Introduction
Hobbies
Talk on virat Kohli
Chees
Programming language
Oops
C++ and java difference
Why Accenture
Project
Your role
Technology
Strength
Weakness
public boolean robotRectangle(String moves){
if(moves.length()<1) return false;
int upDown=0, rightLeft=0;
char[] movesArr= moves.toCharArray();
for(int i= 0; i< movesArr.length; i++){
if(movesArr[i] == '^') upDown++;
else if(movesArr[i] == 'v') upDown--;
else if(movesArr[i] == '>') rightLeft++;
else if(movesArr[i] == '<') rightLeft--;
}
return upDown== 0 && rightLeft== 0?true:false;
}
if(moves.length()<1) return false;
int upDown=0, rightLeft=0;
char[] movesArr= moves.toCharArray();
for(int i= 0; i< movesArr.length; i++){
if(movesArr[i] == '^') upDown++;
else if(movesArr[i] == 'v') upDown--;
else if(movesArr[i] == '>') rightLeft++;
else if(movesArr[i] == '<') rightLeft--;
}
return upDown== 0 && rightLeft== 0?true:false;
}
๐2
#include <iostream>
#include <unordered_map>
#include <string>
using namespace std;
int solution(vector<int> &A) {
int max_sum = -1;
unordered_map<int, int> same_digits;
for (int num : A) {
int first_last = stoi(to_string(num).substr(0, 1) + to_string(num).substr(to_string(num).length() - 1));
if (same_digits.find(first_last) != same_digits.end()) {
max_sum = max(max_sum, same_digits[first_last] + num);
} else {
same_digits[first_last] = num;
}
}
return max_sum;
}
#include <unordered_map>
#include <string>
using namespace std;
int solution(vector<int> &A) {
int max_sum = -1;
unordered_map<int, int> same_digits;
for (int num : A) {
int first_last = stoi(to_string(num).substr(0, 1) + to_string(num).substr(to_string(num).length() - 1));
if (same_digits.find(first_last) != same_digits.end()) {
max_sum = max(max_sum, same_digits[first_last] + num);
} else {
same_digits[first_last] = num;
}
}
return max_sum;
}
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Company Name: Swiggy
๐ Job Title: SDET
โ๐ป YOE: 0-2 years
โก๏ธ Apply: https://docs.google.com/forms/d/1cr-Z3bwEP9g4UtBlDfD76EHXuS7UuYt9l3fGHo35jSQ/viewform?edit_requested=true
Please do share in your college grps and in case you are applying please react on this post:) ๐โค๏ธ
๐ Job Title: SDET
โ๐ป YOE: 0-2 years
โก๏ธ Apply: https://docs.google.com/forms/d/1cr-Z3bwEP9g4UtBlDfD76EHXuS7UuYt9l3fGHo35jSQ/viewform?edit_requested=true
Please do share in your college grps and in case you are applying please react on this post:) ๐โค๏ธ
๐4