Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Company Name: Qualcomm
๐ Job Title: Software Engineer Intern (2024 grads) and Hardware Engineer Intern (2025 grads)
โ๐ป YOE: 2024 and 2025 grads
โก๏ธ Apply: https://careers.qualcomm.com/careers/job/446697880255?hl=en-US&domain=qualcomm.com&source=APPLICANT_SOURCE-6-2&source=APPLICANT_SOURCE-6-2
Please do share in your college grps and in case you are applying please react on this post:) ๐โค๏ธ
๐ Job Title: Software Engineer Intern (2024 grads) and Hardware Engineer Intern (2025 grads)
โ๐ป YOE: 2024 and 2025 grads
โก๏ธ Apply: https://careers.qualcomm.com/careers/job/446697880255?hl=en-US&domain=qualcomm.com&source=APPLICANT_SOURCE-6-2&source=APPLICANT_SOURCE-6-2
Please do share in your college grps and in case you are applying please react on this post:) ๐โค๏ธ
โค1
def min_remaining_length(seq):
stack = []
for char in seq:
if char == "A" or char == "B":
if stack and stack[-1] == "A" and char == "B":
stack.pop()
elif stack and stack[-1] == "B" and char == "B":
stack.pop()
else:
stack.append(char)
else:
stack.append(char)
return len(stack)
Substring Removal โ
JPMC code for good
stack = []
for char in seq:
if char == "A" or char == "B":
if stack and stack[-1] == "A" and char == "B":
stack.pop()
elif stack and stack[-1] == "B" and char == "B":
stack.pop()
else:
stack.append(char)
else:
stack.append(char)
return len(stack)
Substring Removal โ
JPMC code for good
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
import java.util.*;
public class Main {
public static String getLargestNumber(String num) {
StringBuilder ans = new StringBuilder();
StringBuilder s = new StringBuilder();
for (int i = 0; i < num.length() - 1; i++) {
if ((num.charAt(i) - '0') % 2 == (num.charAt(i + 1) - '0') % 2) {
s.append(num.charAt(i));
} else {
s.append(num.charAt(i));
char[] chars = s.toString().toCharArray();
Arrays.sort(chars);
ans.append(new StringBuilder(new String(chars)).reverse());
s.setLength(0);
}
}
s.append(num.charAt(num.length() - 1));
char[] chars = s.toString().toCharArray();
Arrays.sort(chars);
ans.append(new StringBuilder(new String(chars)).reverse());
return ans.toString();
}
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String s = scanner.next();
scanner.close();
System.out.println(getLargestNumber(s));
}
}
Swap Parity โ
JPMC code for good
public class Main {
public static String getLargestNumber(String num) {
StringBuilder ans = new StringBuilder();
StringBuilder s = new StringBuilder();
for (int i = 0; i < num.length() - 1; i++) {
if ((num.charAt(i) - '0') % 2 == (num.charAt(i + 1) - '0') % 2) {
s.append(num.charAt(i));
} else {
s.append(num.charAt(i));
char[] chars = s.toString().toCharArray();
Arrays.sort(chars);
ans.append(new StringBuilder(new String(chars)).reverse());
s.setLength(0);
}
}
s.append(num.charAt(num.length() - 1));
char[] chars = s.toString().toCharArray();
Arrays.sort(chars);
ans.append(new StringBuilder(new String(chars)).reverse());
return ans.toString();
}
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String s = scanner.next();
scanner.close();
System.out.println(getLargestNumber(s));
}
}
Swap Parity โ
JPMC code for good
๐1
Minimum Total Cost โ
JPMC
JPMC
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐Furrl is hiring for Software Development Engineer Intern (ReactJS) - Remote
Stipend: 20k-25k per month
๐Apply here: https://wellfound.com/jobs/2973753-software-development-engineer-intern-reactjs
Stipend: 20k-25k per month
๐Apply here: https://wellfound.com/jobs/2973753-software-development-engineer-intern-reactjs
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
#include <iostream>
#include <vector>
using namespace std;
int edgeWeightsSum(int tree_nodes, vector<int>& tree_weight) {
int sum = 0;
for (int weight : tree_weight) {
sum += weight;
}
return sum;
}
Customizable Tours with GoWorld โ
#include <vector>
using namespace std;
int edgeWeightsSum(int tree_nodes, vector<int>& tree_weight) {
int sum = 0;
for (int weight : tree_weight) {
sum += weight;
}
return sum;
}
Customizable Tours with GoWorld โ
๐3โค2
#include <bits/stdc++.h>
using namespace std;
int countWithOddSetBits(int n)
{
if (n % 2 != 0)
return (n + 1) / 2;
int count = __builtin_popcount(n);
int ans = n / 2;
if (count % 2 != 0)
ans++;
return ans;
}
int main()
{
int l,r;
cin>>l>>r;
cout << countWithOddSetBits(r)-countWithOddSetBits(l);
return 0;
}
Hackwithinfy โ
using namespace std;
int countWithOddSetBits(int n)
{
if (n % 2 != 0)
return (n + 1) / 2;
int count = __builtin_popcount(n);
int ans = n / 2;
if (count % 2 != 0)
ans++;
return ans;
}
int main()
{
int l,r;
cin>>l>>r;
cout << countWithOddSetBits(r)-countWithOddSetBits(l);
return 0;
}
Hackwithinfy โ
๐1
def count_good_numbers(L, R):
count = 0
for num in range(L, R+1):
binary = bin(num)[2:]
set_bits = binary.count('1')
if set_bits % 2 == 1:
count += 1
return count
L = int(input())
R = int(input())
print(count_good_numbers(L, R))
count = 0
for num in range(L, R+1):
binary = bin(num)[2:]
set_bits = binary.count('1')
if set_bits % 2 == 1:
count += 1
return count
L = int(input())
R = int(input())
print(count_good_numbers(L, R))
int countWays(int N, int M, int P) {
vector<vector<int>> dp(N + 1, vector<int>(1 << M));
dp[0][0] = 1;
for (int i = 1; i <= N; i++) {
for (int mask = 0; mask < (1 << M); mask++) {
for (int prevMask = 0; prevMask < (1 << M); prevMask++) {
if ((mask & prevMask) == 0 && (mask & (prevMask << 1)) == 0 && (prevMask & (mask << 1)) == 0) {
dp[i][mask] = (dp[i][mask] + dp[i - 1][prevMask]) % P;
}
}
}
}
int totalWays = 0;
for (int mask = 0; mask < (1 << M); mask++) {
totalWays = (totalWays + dp[N][mask]) % P;
}
return totalWays;
}
Lonely pieces
Hackwithinfy โ
vector<vector<int>> dp(N + 1, vector<int>(1 << M));
dp[0][0] = 1;
for (int i = 1; i <= N; i++) {
for (int mask = 0; mask < (1 << M); mask++) {
for (int prevMask = 0; prevMask < (1 << M); prevMask++) {
if ((mask & prevMask) == 0 && (mask & (prevMask << 1)) == 0 && (prevMask & (mask << 1)) == 0) {
dp[i][mask] = (dp[i][mask] + dp[i - 1][prevMask]) % P;
}
}
}
}
int totalWays = 0;
for (int mask = 0; mask < (1 << M); mask++) {
totalWays = (totalWays + dp[N][mask]) % P;
}
return totalWays;
}
Lonely pieces
Hackwithinfy โ
๐1
vector<ll> solve(vector<int>& p, vector<int>& q) {
sort(p.begin(), p.end());
vector<ll> pre(p.size() + 1);
for (int i = 0; i < p.size(); ++i) {
pre[i + 1] = pre[i] + p[i];
}
vector<ll> res;
for (int x : q) {
int idx = lower_bound(p.begin(), p.end(), x) - p.begin();
ll total = pre[p.size()] - 2 * pre[idx] + (ll)x * (2 * idx - p.size());
res.push_back(total);
}
return res;
}
Equal Price โ
sort(p.begin(), p.end());
vector<ll> pre(p.size() + 1);
for (int i = 0; i < p.size(); ++i) {
pre[i + 1] = pre[i] + p[i];
}
vector<ll> res;
for (int x : q) {
int idx = lower_bound(p.begin(), p.end(), x) - p.begin();
ll total = pre[p.size()] - 2 * pre[idx] + (ll)x * (2 * idx - p.size());
res.push_back(total);
}
return res;
}
Equal Price โ
#include <bits/stdc++.h>
using namespace std;
bool isPalindrome(string s) {
int i = 0, j = s.size() - 1;
while (i < j) {
if (s[i] != s[j]) {
return false;
}
i++;
j--;
}
return true;
}
int getScore(string s, int L, int R) {
int freq[26] = {0};
for (int i = L; i < R; i++) {
freq[s[i] - 'a']++;
}
int oddCount = 0;
for (int i = 0; i < 26; i++) {
if (freq[i] % 2 != 0) {
oddCount++;
}
}
return max(0, oddCount - 1);
}
int main() {
string S;
cin >> S;
int Q;
cin >> Q;
int sum = 0;
for (int q = 0; q < Q; q++) {
int type;
cin >> type;
if (type == 1) {
int i, j;
cin >> i >> j;
S[i - 1] = 'a' + j - 1;
} else if (type == 2) {
int L, R;
cin >> L >> R;
sum += getScore(S, L - 1, R);
}
}
cout << sum % (int)(1e9 + 7) << endl;
return 0;
}
//Score of stringโ
using namespace std;
bool isPalindrome(string s) {
int i = 0, j = s.size() - 1;
while (i < j) {
if (s[i] != s[j]) {
return false;
}
i++;
j--;
}
return true;
}
int getScore(string s, int L, int R) {
int freq[26] = {0};
for (int i = L; i < R; i++) {
freq[s[i] - 'a']++;
}
int oddCount = 0;
for (int i = 0; i < 26; i++) {
if (freq[i] % 2 != 0) {
oddCount++;
}
}
return max(0, oddCount - 1);
}
int main() {
string S;
cin >> S;
int Q;
cin >> Q;
int sum = 0;
for (int q = 0; q < Q; q++) {
int type;
cin >> type;
if (type == 1) {
int i, j;
cin >> i >> j;
S[i - 1] = 'a' + j - 1;
} else if (type == 2) {
int L, R;
cin >> L >> R;
sum += getScore(S, L - 1, R);
}
}
cout << sum % (int)(1e9 + 7) << endl;
return 0;
}
//Score of stringโ
๐2
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
#include<bits/stdc++.h>
using namespace std;
vector<string> getResponses(vector<string> valid_auth_tokens, vector<pair<string, string>> requests) {
vector<string> res;
for(auto request : requests) {
string rt = request.first;
string url = request.second;
string params = url.substr(url.find('?') + 1);
stringstream ss(params);
string token;
string elon;
string au = "";
string csr = "";
while(getline(ss, elon, '&')) {
string key = elon.substr(0, elon.find('='));
string value = elon.substr(elon.find('=') + 1);
if(key == "token") {
au = value;
} else if(key == "csrf") {
csr = value;
}
}
if(find(valid_auth_tokens.begin(), valid_auth_tokens.end(), au) == valid_auth_tokens.end()) {
res.push_back("INVALID");
} else if(rt == "POST" && (csr.empty()!all_of(csr.begin(), csr.end(), ::isalnum) csr.size() < 8)) {
res.push_back("INVALID");
} else {
string rss = "VALID";
stringstream ss(params);
while(getline(ss, elon, '&')) {
string key = elon.substr(0, elon.find('='));
string value = elon.substr(elon.find('=') + 1);
if(key != "token" && key != "csrf") {
rss += "," + key + "," + value;
}
}
res.push_back(rss);
}
}
return res;
}
Request Parser โ
Source : Hola
using namespace std;
vector<string> getResponses(vector<string> valid_auth_tokens, vector<pair<string, string>> requests) {
vector<string> res;
for(auto request : requests) {
string rt = request.first;
string url = request.second;
string params = url.substr(url.find('?') + 1);
stringstream ss(params);
string token;
string elon;
string au = "";
string csr = "";
while(getline(ss, elon, '&')) {
string key = elon.substr(0, elon.find('='));
string value = elon.substr(elon.find('=') + 1);
if(key == "token") {
au = value;
} else if(key == "csrf") {
csr = value;
}
}
if(find(valid_auth_tokens.begin(), valid_auth_tokens.end(), au) == valid_auth_tokens.end()) {
res.push_back("INVALID");
} else if(rt == "POST" && (csr.empty()
res.push_back("INVALID");
} else {
string rss = "VALID";
stringstream ss(params);
while(getline(ss, elon, '&')) {
string key = elon.substr(0, elon.find('='));
string value = elon.substr(elon.find('=') + 1);
if(key != "token" && key != "csrf") {
rss += "," + key + "," + value;
}
}
res.push_back(rss);
}
}
return res;
}
Request Parser โ
Source : Hola
๐4โค2๐1
def remove_duplicate_words(sentence):
words = sentence.split()
unique_words = []
seen = set()
for word in words:
if word not in seen:
unique_words.append(word)
seen.add(word)
return ' '.join(unique_words)
T = int(input())
for _ in range(T):
N = int(input())
sentence = input()
print(remove_duplicate_words(sentence))
GWC โ
words = sentence.split()
unique_words = []
seen = set()
for word in words:
if word not in seen:
unique_words.append(word)
seen.add(word)
return ' '.join(unique_words)
T = int(input())
for _ in range(T):
N = int(input())
sentence = input()
print(remove_duplicate_words(sentence))
GWC โ