Oracle MCQ/Code Solution โ
Everyone receive Amazon Dublin OA link?
React ๐ if you received, ๐ if havenโt received!!
React ๐ if you received, ๐ if havenโt received!!
๐4๐1
After many messages like above, I have created new channel where will update job opportunities only for experienced candidates. (It will be difficult to manage 2 channel but will try my best).
Here is the link:
https://t.me/codingsamurai
#KeepSharingwithseniors
Here is the link:
https://t.me/codingsamurai
#KeepSharingwithseniors
Telegram
Experience Jobs & Materials
300+ Placement & Competitive Exam Materials
75+ Companies Materials
10+ Weekly Udemy Course Coupons
Daily Off Campus Jobs Updates
India's Biggest Placement Channel!!
โ๐ดโ๐ดโ๐ฉโ๐ปโ๐โ
๐ Share and Support
Buy ads: https://telega.io/c/codingsamurai
75+ Companies Materials
10+ Weekly Udemy Course Coupons
Daily Off Campus Jobs Updates
India's Biggest Placement Channel!!
โ๐ดโ๐ดโ๐ฉโ๐ปโ๐โ
๐ Share and Support
Buy ads: https://telega.io/c/codingsamurai
๐2
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ pinned ยซAfter many messages like above, I have created new channel where will update job opportunities only for experienced candidates. (It will be difficult to manage 2 channel but will try my best). Here is the link: https://t.me/codingsamurai #KeepSharingwithseniorsยป
def check_similar_passwords(new_passwords, old_passwords):
ans = []
for new_pass, old_pass in zip(new_passwords, old_passwords):
i, j = 0, 0
while i < len(new_pass) and j < len(old_pass):
new_char = new_pass[i]
old_char = old_pass[j]
new_shifted_char = 'a' if new_char == 'z' else chr(ord(new_char) + 1)
if old_char == new_char or old_char == new_shifted_char:
j += 1
i += 1
ans.append("YES" if j == len(old_pass) else "NO")
return ans
new_passwords = ["aaccbbee", "aab"]
old_passwords = ["bdbf", "aee"]
print(check_similar_passwords(new_passwords, old_passwords))
Python 3โ
(Amazon)
๐1๐คฉ1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Company Name: BarRaiser
Role: Backend Intern
Batch eligible: 2024 and 2025 grads
Duration: 6 months
Apply: https://www.linkedin.com/jobs/view/3688872459
Role: Backend Intern
Batch eligible: 2024 and 2025 grads
Duration: 6 months
Apply: https://www.linkedin.com/jobs/view/3688872459
Linkedin
7,000+ Intern jobs in India (301 new)
Todayโs top 7,000+ Intern jobs in India. Leverage your professional network, and get hired. New Intern jobs added daily.
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Zypp Electric Hiring This Position
1. Business Head - Expansion
2. Data/AI/ML Strategy/Product Head
3. Engineering Lead
4. Data Scientist
5. Battery and Motor specialist
https://docs.google.com/forms/d/e/1FAIpQLSfynJaXx3tcjdKsxTOtzzsXaV4Arn397OdQEOU6TjBbCjLYng/viewform
1. Business Head - Expansion
2. Data/AI/ML Strategy/Product Head
3. Engineering Lead
4. Data Scientist
5. Battery and Motor specialist
https://docs.google.com/forms/d/e/1FAIpQLSfynJaXx3tcjdKsxTOtzzsXaV4Arn397OdQEOU6TjBbCjLYng/viewform
#include <bits/stdc++.h>
using namespace std;
int getMaxCount(vector<int>people,vector<char>status){
int i=0;
int ans=0;
map<int,int>mp;
int n=status.size();
for(int i=0;i<n;i++){
int bro=people[i];
if(status[i]=='-'){
mp[bro]--;
if(mp[bro]==0){
mp.erase(bro);
}
}else{
mp[bro]++;
}
int helo=mp.size();
ans=max(ans,helo);
}
return ans;
}
int main() {
int n;
cin>>n;
vector<int>vec(n);
vector<char>vec2(n);
for(int i=0;i<n;i++){
cin>>vec[i];
}
for(int i=0;i<n;i++){
cin>>vec2[i];
}
cout<<getMaxCount(vec,vec2);
return 0;
}
Amazon Dublin โ
using namespace std;
int getMaxCount(vector<int>people,vector<char>status){
int i=0;
int ans=0;
map<int,int>mp;
int n=status.size();
for(int i=0;i<n;i++){
int bro=people[i];
if(status[i]=='-'){
mp[bro]--;
if(mp[bro]==0){
mp.erase(bro);
}
}else{
mp[bro]++;
}
int helo=mp.size();
ans=max(ans,helo);
}
return ans;
}
int main() {
int n;
cin>>n;
vector<int>vec(n);
vector<char>vec2(n);
for(int i=0;i<n;i++){
cin>>vec[i];
}
for(int i=0;i<n;i++){
cin>>vec2[i];
}
cout<<getMaxCount(vec,vec2);
return 0;
}
Amazon Dublin โ
long ans = 0;
for (int i = 0; i < arr.size(); i++)
{
map<int, int> m;
for (int j = i; j < arr.size(); j++)
{
m[arr[j]]++;
}
ans += m.size();
}
return ans;
Amazon Dublin OAโ
for (int i = 0; i < arr.size(); i++)
{
map<int, int> m;
for (int j = i; j < arr.size(); j++)
{
m[arr[j]]++;
}
ans += m.size();
}
return ans;
Amazon Dublin OAโ
๐คฉ1
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
bool isBalanced(const string& s) {
int balance = 0;
for (char c : s) {
if (c == '[') {
balance++;
} else if (c == ']') {
balance--;
}
}
return balance == 0;
}
string generateRegex(const string& a, const string& b, const string& c) {
int maxLength = a.size() + b.size() + 4; // 4 accounts for potential "[...]" brackets
string longestRegex;
for (int len = maxLength; len >= 0; len--) {
for (int i = 0; i < a.size(); i++) {
for (int j = 0; j < b.size(); j++) {
if (i + len > a.size() || j + len > b.size()) {
continue;
}
string substrA = a.substr(i, len);
string substrB = b.substr(j, len);
if (isBalanced(substrA) && isBalanced(substrB)) {
string regex = "[" + substrA + substrB + "]";
if (regex.find(c) == string::npos && regex.size() > longestRegex.size()) {
longestRegex = regex;
}
}
}
}
}
return longestRegex;
}
int main() {
string a = "DABCIBC";
string b = "ABCA";
string c = "BBCA";
string longestRegex = generateRegex(a, b, c);
cout << longestRegex << endl;
return 0;
}
Amazon Dublin โ
#include <vector>
#include <algorithm>
using namespace std;
bool isBalanced(const string& s) {
int balance = 0;
for (char c : s) {
if (c == '[') {
balance++;
} else if (c == ']') {
balance--;
}
}
return balance == 0;
}
string generateRegex(const string& a, const string& b, const string& c) {
int maxLength = a.size() + b.size() + 4; // 4 accounts for potential "[...]" brackets
string longestRegex;
for (int len = maxLength; len >= 0; len--) {
for (int i = 0; i < a.size(); i++) {
for (int j = 0; j < b.size(); j++) {
if (i + len > a.size() || j + len > b.size()) {
continue;
}
string substrA = a.substr(i, len);
string substrB = b.substr(j, len);
if (isBalanced(substrA) && isBalanced(substrB)) {
string regex = "[" + substrA + substrB + "]";
if (regex.find(c) == string::npos && regex.size() > longestRegex.size()) {
longestRegex = regex;
}
}
}
}
}
return longestRegex;
}
int main() {
string a = "DABCIBC";
string b = "ABCA";
string c = "BBCA";
string longestRegex = generateRegex(a, b, c);
cout << longestRegex << endl;
return 0;
}
Amazon Dublin โ
๐2
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
bool isValidMove(int x, int y, const vector<vector<char>>& maze, char forb) {
int rows = maze.size();
int cols = maze[0].size();
return x >= 0 && x < rows && y >= 0 && y < cols && maze[x][y] != forb;
}
int bfs(const vector<vector<char>>& maze, char forb) {
int rows = maze.size();
int cols = maze[0].size();
pair<int, int> start = make_pair(0, 0);
pair<int, int> end = make_pair(rows - 1, cols - 1);
vector<vector<bool>> visited(rows, vector<bool>(cols, false));
deque<tuple<int, int, int>> queue;
queue.push_back(make_tuple(start.first, start.second, 0));
while (!queue.empty()) {
int x, y, length;
tie(x, y, length) = queue.front();
queue.pop_front();
if (make_pair(x, y) == end) {
return length;
}
if (!visited[x][y]) {
visited[x][y] = true;
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
for (int i = 0; i < 4; ++i) {
int new_x = x + dx[i];
int new_y = y + dy[i];
if (isValidMove(new_x, new_y, maze, forb)) {
queue.push_back(make_tuple(new_x, new_y, length + 1));
}
}
}
}
return -1; // No path found
}
The Maze Runner โ
int rows = maze.size();
int cols = maze[0].size();
return x >= 0 && x < rows && y >= 0 && y < cols && maze[x][y] != forb;
}
int bfs(const vector<vector<char>>& maze, char forb) {
int rows = maze.size();
int cols = maze[0].size();
pair<int, int> start = make_pair(0, 0);
pair<int, int> end = make_pair(rows - 1, cols - 1);
vector<vector<bool>> visited(rows, vector<bool>(cols, false));
deque<tuple<int, int, int>> queue;
queue.push_back(make_tuple(start.first, start.second, 0));
while (!queue.empty()) {
int x, y, length;
tie(x, y, length) = queue.front();
queue.pop_front();
if (make_pair(x, y) == end) {
return length;
}
if (!visited[x][y]) {
visited[x][y] = true;
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
for (int i = 0; i < 4; ++i) {
int new_x = x + dx[i];
int new_y = y + dy[i];
if (isValidMove(new_x, new_y, maze, forb)) {
queue.push_back(make_tuple(new_x, new_y, length + 1));
}
}
}
}
return -1; // No path found
}
The Maze Runner โ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Company Name: Rubrik
Role: Software Engineer Intern
Batch eligible: 2024 grads only
Stipend: 1.5 Lac per month
Apply: https://www.rubrik.com/company/careers/departments/job.5225502.1929
Share with Friends โ๐ป
Role: Software Engineer Intern
Batch eligible: 2024 grads only
Stipend: 1.5 Lac per month
Apply: https://www.rubrik.com/company/careers/departments/job.5225502.1929
Share with Friends โ๐ป
Rubrik
Error
int maximumLearning(vector<int>& articles, vector<int>& iv, int p) {
int n = articles.size();
vector<pair<int, int>> associated;
for (int i = 0; i < n; ++i) {
associated.push_back({2 * articles[i], iv[i]});
}
int maxIntelValue = 0;
for (int mask = 0; mask < (1 << n); ++mask) {
int pagesRead = 0;
int currentValue = 0;
for (int i = 0; i < n; ++i) {
if (mask & (1 << i)) {
if (pagesRead + associated[i].first <= p) {
pagesRead += associated[i].first;
currentValue += associated[i].second;
}
}
}
maxIntelValue = max(maxIntelValue, currentValue);
}
return maxIntelValue;
}
Atlassian โ
int n = articles.size();
vector<pair<int, int>> associated;
for (int i = 0; i < n; ++i) {
associated.push_back({2 * articles[i], iv[i]});
}
int maxIntelValue = 0;
for (int mask = 0; mask < (1 << n); ++mask) {
int pagesRead = 0;
int currentValue = 0;
for (int i = 0; i < n; ++i) {
if (mask & (1 << i)) {
if (pagesRead + associated[i].first <= p) {
pagesRead += associated[i].first;
currentValue += associated[i].second;
}
}
}
maxIntelValue = max(maxIntelValue, currentValue);
}
return maxIntelValue;
}
Atlassian โ
typedef long long ll;
pair<ll, ll> dfs(ll curr, ll prv, const vector<vector<ll>>& adj, const vector<ll>& connect_val, ll k) {
ll tmp = connect_val[curr - 1];
pair<ll, ll> ans = {tmp, tmp};
for (ll x : adj[curr]) {
if (x == prv) continue;
auto tmp = dfs(x, curr, adj, connect_val, k);
ans.second += tmp.second;
ans.first += tmp.first;
}
ans.first = max(ans.first, -k);
return ans;
}
long long get_max_efficiency(ll connect_nodes, const vector<ll>& connect_from, const vector<ll>& connect_to, const vector<ll>& connect_val, ll k) {
ll n = connect_nodes;
vector<vector<ll>> adj(n + 1);
for (ll i = 0; i < connect_from.size(); i++) {
ll u = connect_from[i], v = connect_to[i];
adj[u].push_back(v);
adj[v].push_back(u);
}
return dfs(1, 0, adj, connect_val, k).first;
}
Graph one
Atlassian โ
pair<ll, ll> dfs(ll curr, ll prv, const vector<vector<ll>>& adj, const vector<ll>& connect_val, ll k) {
ll tmp = connect_val[curr - 1];
pair<ll, ll> ans = {tmp, tmp};
for (ll x : adj[curr]) {
if (x == prv) continue;
auto tmp = dfs(x, curr, adj, connect_val, k);
ans.second += tmp.second;
ans.first += tmp.first;
}
ans.first = max(ans.first, -k);
return ans;
}
long long get_max_efficiency(ll connect_nodes, const vector<ll>& connect_from, const vector<ll>& connect_to, const vector<ll>& connect_val, ll k) {
ll n = connect_nodes;
vector<vector<ll>> adj(n + 1);
for (ll i = 0; i < connect_from.size(); i++) {
ll u = connect_from[i], v = connect_to[i];
adj[u].push_back(v);
adj[v].push_back(u);
}
return dfs(1, 0, adj, connect_val, k).first;
}
Graph one
Atlassian โ
ll solve(ll n, ll m, ll k) {
vector<int>a(n, 1);
k--;
ll sum = n, maxjob = 1;
while(sum <= m) {
a[k]++;
maxjob = a[k];
for(ll i = k - 1; i >= 0; i--) {
if(a[i + 1] - a[i] > 1) a[i]++;
}
for(ll i = k + 1; i < n; i++) {
if(a[i - 1] - a[i] > 1) a[i]++;
}
sum = 0;
for(ll i = 0; i < n; i++) sum += a[i];
}
}
Job one
Atlassian โ
vector<int>a(n, 1);
k--;
ll sum = n, maxjob = 1;
while(sum <= m) {
a[k]++;
maxjob = a[k];
for(ll i = k - 1; i >= 0; i--) {
if(a[i + 1] - a[i] > 1) a[i]++;
}
for(ll i = k + 1; i < n; i++) {
if(a[i - 1] - a[i] > 1) a[i]++;
}
sum = 0;
for(ll i = 0; i < n; i++) sum += a[i];
}
}
Job one
Atlassian โ