๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
int min_time_to_enter_room(int n, vector<vector<int>>& entryTime) {
vector<vector<int>> directions = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
vector<vector<int>> earliest_time(n, vector<int>(n, INT_MAX));
priority_queue<pair<int, pair<int, int>>, vector<pair<int, pair<int, int>>>, greater<>> pq;
pq.push({0, {0, 0}});
earliest_time[0][0] = 0;
while (!pq.empty()) {
int current_time = pq.top().first;
int x = pq.top().second.first;
int y = pq.top().second.second;
pq.pop();
if (x == n - 1 && y == n - 1) return current_time;
for (auto& dir : directions) {
int nx = x + dir[0];
int ny = y + dir[1];
if (nx >= 0 && ny >= 0 && nx < n && ny < n) {
int next_time = max(current_time, entryTime[nx][ny]);
if (next_time < earliest_time[nx][ny]) {
earliest_time[nx][ny] = next_time;
pq.push({next_time, {nx, ny}});
}
}
}
}
return -1;
}
Uber (intern) โ
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
int min_time_to_enter_room(int n, vector<vector<int>>& entryTime) {
vector<vector<int>> directions = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
vector<vector<int>> earliest_time(n, vector<int>(n, INT_MAX));
priority_queue<pair<int, pair<int, int>>, vector<pair<int, pair<int, int>>>, greater<>> pq;
pq.push({0, {0, 0}});
earliest_time[0][0] = 0;
while (!pq.empty()) {
int current_time = pq.top().first;
int x = pq.top().second.first;
int y = pq.top().second.second;
pq.pop();
if (x == n - 1 && y == n - 1) return current_time;
for (auto& dir : directions) {
int nx = x + dir[0];
int ny = y + dir[1];
if (nx >= 0 && ny >= 0 && nx < n && ny < n) {
int next_time = max(current_time, entryTime[nx][ny]);
if (next_time < earliest_time[nx][ny]) {
earliest_time[nx][ny] = next_time;
pq.push({next_time, {nx, ny}});
}
}
}
}
return -1;
}
Uber (intern) โ
๐1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Siemens is hiring Junior Rust Developer
For 2024, 2023 grads
https://jobs.siemens.com/careers/job/563156120514017?hl=en
For 2024, 2023 grads
https://jobs.siemens.com/careers/job/563156120514017?hl=en
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Exciting Opportunity for freshers to Kickstart their Career โค๏ธโค๏ธโค๏ธ๐ฅ๐ฅ๐ฅ๐ช๐ช๐ช
Freshers WalkIn Alert ๐ฅ๐ฅ
Process- Back Office
Eligibility - Only Fresher/ Intern
Graduate- 2021 or above
Note- BE/B.Tech are not eligible.
Location: Gurgaon
Date of Interview: 23rd August, 2024.
Time: 10 AM
Address: 8th Floor, Big Audi, Tower C, Building 14, Sector 24 & 25 A, Gurugram- 122001.
Things to Carry:
Aadhaar Card
2 Copy of Resume
To confirm attendance, email harmeet.2.singh@bt.com with "Yes, I will be coming" for prior security approval.
Freshers WalkIn Alert ๐ฅ๐ฅ
Process- Back Office
Eligibility - Only Fresher/ Intern
Graduate- 2021 or above
Note- BE/B.Tech are not eligible.
Location: Gurgaon
Date of Interview: 23rd August, 2024.
Time: 10 AM
Address: 8th Floor, Big Audi, Tower C, Building 14, Sector 24 & 25 A, Gurugram- 122001.
Things to Carry:
Aadhaar Card
2 Copy of Resume
To confirm attendance, email harmeet.2.singh@bt.com with "Yes, I will be coming" for prior security approval.
๐2
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Wipro Elite is hiring
Apply (if your college is eligible)
2023 & 2024 Batch students are eligible
Branch : BE/B.TECH/ME/M.TECH
Percentage criteria: 60% Throughout
Apply link :- https://app.joinsuperset.com/join/#/signup/student?jp=fd4be287-c8d5-4ace-ac26-6875ca63bc34
Apply (if your college is eligible)
2023 & 2024 Batch students are eligible
Branch : BE/B.TECH/ME/M.TECH
Percentage criteria: 60% Throughout
Apply link :- https://app.joinsuperset.com/join/#/signup/student?jp=fd4be287-c8d5-4ace-ac26-6875ca63bc34
๐1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Metacube Software Pvt Ltd | Jaipur, Rajasthan
Eligibility Criteria (Minimum percentage)
Minimum 10th Percentage 70%
Minimum 12th Percentage 70%
Minimum College Percentage 65%
https://www.tpohub.com/#/student-drive/details/set-2024-08-23-jaipur-raj-job-off-metacube-software-engineer-trainee/1253
Eligibility Criteria (Minimum percentage)
Minimum 10th Percentage 70%
Minimum 12th Percentage 70%
Minimum College Percentage 65%
https://www.tpohub.com/#/student-drive/details/set-2024-08-23-jaipur-raj-job-off-metacube-software-engineer-trainee/1253
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Linkedin
Mohit G. on LinkedIn: #hiring #zepto #engineering #joinus | 62 comments
๐ Exciting Opportunities at Zepto! ๐
I am hiring for my team across below levels and roles :
SDE-1
SDE-2
SDE-3 ( SSE )
SDE-4 ( Tech Lead )
If youโreโฆ | 62 comments on LinkedIn
I am hiring for my team across below levels and roles :
SDE-1
SDE-2
SDE-3 ( SSE )
SDE-4 ( Tech Lead )
If youโreโฆ | 62 comments on LinkedIn
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include<climits>
using namespace std;
const int MOD = 1e9 + 7;
class Solution {
public:
int removeIntegers(int N, int P, int Q, vector<int>& special_integers) {
sort(special_integers.begin(), special_integers.end());
unordered_map<int, bool> is_special;
for (int num : special_integers)
is_special[num] = true;
return minCost(1, 1 << N, P, Q, is_special);
}
private:
int minCost(int start, int end, int P, int Q, unordered_map<int, bool>& is_special) {
int length = end - start + 1;
if (length == 1) {
return is_special[start] ? P : Q;
}
if (is_power_of_two(length)) {
return is_special[start] ? (P * length) : Q;
}
int min_cost = INT_MAX;
for (int mid = start; mid < end; ++mid) {
int left_length = mid - start + 1;
int right_length = end - mid;
int left_cost = minCost(start, mid, P, Q, is_special);
int right_cost = minCost(mid + 1, end, P, Q, is_special);
min_cost = min(min_cost, left_cost + right_cost);
}
min_cost = min(min_cost, is_special[start] ? (P * length) : Q);
return min_cost;
}
bool is_power_of_two(int n) {
return (n & (n - 1)) == 0;
}
};
BNYโ
#include <vector>
#include <algorithm>
#include <unordered_map>
#include<climits>
using namespace std;
const int MOD = 1e9 + 7;
class Solution {
public:
int removeIntegers(int N, int P, int Q, vector<int>& special_integers) {
sort(special_integers.begin(), special_integers.end());
unordered_map<int, bool> is_special;
for (int num : special_integers)
is_special[num] = true;
return minCost(1, 1 << N, P, Q, is_special);
}
private:
int minCost(int start, int end, int P, int Q, unordered_map<int, bool>& is_special) {
int length = end - start + 1;
if (length == 1) {
return is_special[start] ? P : Q;
}
if (is_power_of_two(length)) {
return is_special[start] ? (P * length) : Q;
}
int min_cost = INT_MAX;
for (int mid = start; mid < end; ++mid) {
int left_length = mid - start + 1;
int right_length = end - mid;
int left_cost = minCost(start, mid, P, Q, is_special);
int right_cost = minCost(mid + 1, end, P, Q, is_special);
min_cost = min(min_cost, left_cost + right_cost);
}
min_cost = min(min_cost, is_special[start] ? (P * length) : Q);
return min_cost;
}
bool is_power_of_two(int n) {
return (n & (n - 1)) == 0;
}
};
BNYโ
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
import java.util.*;
public class Main {
static int countUniqueSubsets(int[] arr, int N, int K) {
Arrays.sort(arr);
return countUniqueSubsetsUtil(arr, N, K, 0, 0);
}
static int countUniqueSubsetsUtil(int[] arr, int N, int K, int currentIndex, int currentSum) {
if (currentSum == K) {
return 1;
}
if (currentSum > K || currentIndex >= N) {
return 0;
}
int count = 0;
count += countUniqueSubsetsUtil(arr, N, K, currentIndex + 1, currentSum + arr[currentIndex]);
while (currentIndex + 1 < N && arr[currentIndex] == arr[currentIndex + 1]) {
currentIndex++;
}
count += countUniqueSubsetsUtil(arr, N, K, currentIndex + 1, currentSum);
return count;
}
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int N = scanner.nextInt();
int K = scanner.nextInt();
int[] arr = new int[N];
for (int i = 0; i < N; i++) {
arr[i] = scanner.nextInt();
}
System.out.println(countUniqueSubsets(arr, N, K));
}
}
The puzzle masters of puzzleville โ
public class Main {
static int countUniqueSubsets(int[] arr, int N, int K) {
Arrays.sort(arr);
return countUniqueSubsetsUtil(arr, N, K, 0, 0);
}
static int countUniqueSubsetsUtil(int[] arr, int N, int K, int currentIndex, int currentSum) {
if (currentSum == K) {
return 1;
}
if (currentSum > K || currentIndex >= N) {
return 0;
}
int count = 0;
count += countUniqueSubsetsUtil(arr, N, K, currentIndex + 1, currentSum + arr[currentIndex]);
while (currentIndex + 1 < N && arr[currentIndex] == arr[currentIndex + 1]) {
currentIndex++;
}
count += countUniqueSubsetsUtil(arr, N, K, currentIndex + 1, currentSum);
return count;
}
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int N = scanner.nextInt();
int K = scanner.nextInt();
int[] arr = new int[N];
for (int i = 0; i < N; i++) {
arr[i] = scanner.nextInt();
}
System.out.println(countUniqueSubsets(arr, N, K));
}
}
The puzzle masters of puzzleville โ
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
import java.util.*;
import java.io.*;
class Main {
public static void main(String args[]) throws Exception {
Scanner sc = new Scanner(System.in);
String input = sc.nextLine();
int indent = 0;
boolean inQuotes = false;
StringBuilder output = new StringBuilder();
for (char ch : input.toCharArray()) {
switch (ch) {
case '{':
case '[':
output.append(ch);
if (!inQuotes) {
output.append("\n");
indent++;
appendIndentation(output, indent);
}
break;
case '}':
case ']':
if (!inQuotes) {
output.append("\n");
indent--;
appendIndentation(output, indent);
}
output.append(ch);
break;
case ',':
output.append(ch);
if (!inQuotes) {
output.append("\n");
appendIndentation(output, indent);
}
break;
case '"':
output.append(ch);
inQuotes = !inQuotes;
break;
default:
output.append(ch);
break;
}
}
System.out.println(output.toString());
}
private static void appendIndentation(StringBuilder sb, int indent) {
for (int i = 0; i < indent; i++) {
sb.append("**");
}
}
}
Json formatter โ
import java.io.*;
class Main {
public static void main(String args[]) throws Exception {
Scanner sc = new Scanner(System.in);
String input = sc.nextLine();
int indent = 0;
boolean inQuotes = false;
StringBuilder output = new StringBuilder();
for (char ch : input.toCharArray()) {
switch (ch) {
case '{':
case '[':
output.append(ch);
if (!inQuotes) {
output.append("\n");
indent++;
appendIndentation(output, indent);
}
break;
case '}':
case ']':
if (!inQuotes) {
output.append("\n");
indent--;
appendIndentation(output, indent);
}
output.append(ch);
break;
case ',':
output.append(ch);
if (!inQuotes) {
output.append("\n");
appendIndentation(output, indent);
}
break;
case '"':
output.append(ch);
inQuotes = !inQuotes;
break;
default:
output.append(ch);
break;
}
}
System.out.println(output.toString());
}
private static void appendIndentation(StringBuilder sb, int indent) {
for (int i = 0; i < indent; i++) {
sb.append("**");
}
}
}
Json formatter โ
#include <bits/stdc++.h>
using namespace std;
string solve(long long N) {
if (N == 0) return "0";
string ans;
while (N) {
int t = N % 62;
if (t <= 9)
ans.push_back('0' + t);
else if (t <= 35)
ans.push_back('A' + t - 10);
else
ans.push_back('a' + t - 36);
N /= 62;
}
reverse(ans.begin(), ans.end());
return ans;
}
Encodeโ
using namespace std;
string solve(long long N) {
if (N == 0) return "0";
string ans;
while (N) {
int t = N % 62;
if (t <= 9)
ans.push_back('0' + t);
else if (t <= 35)
ans.push_back('A' + t - 10);
else
ans.push_back('a' + t - 36);
N /= 62;
}
reverse(ans.begin(), ans.end());
return ans;
}
Encodeโ
#include <bits/stdc++.h>
using namespace std;
void solve(int N, int M, vector<pair<int, int>>& a, int q, vector<int>& queries) {
vector<vector<int>> adj(N + 1);
for (int i = 0; i < M; ++i) {
int u = a[i].first;
int v = a[i].second;
adj[u].push_back(v);
adj[v].push_back(u);
}
for (int i = 1; i <= N; ++i) {
sort(adj[i].begin(), adj[i].end());
}
for (int i = 0; i < q; ++i) {
int prof = queries[i];
if (adj[prof].empty()) {
cout << -1 << endl;
} else {
for (int nbr : adj[prof]) {
cout << nbr << " ";
}
cout << endl;
}
}
}
professors city โ
๐1
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
from collections import defaultdict
def countOfAtoms(formula: str) -> str:
def parse_formula(i):
n = len(formula)
count = defaultdict(int)
while i < n:
if formula[i] == '(':
i, inner_count = parse_formula(i + 1)
multiplier = 0
i += 1
while i < n and formula[i].isdigit():
multiplier = multiplier * 10 + int(formula[i])
i += 1
multiplier = multiplier or 1
for elem in inner_count:
count[elem] += inner_count[elem] * multiplier
elif formula[i] == ')':
return i, count
else:
j = i + 1
while j < n and formula[j].islower():
j += 1
element = formula[i:j]
i = j
multiplier = 0
while j < n and formula[j].isdigit():
multiplier = multiplier * 10 + int(formula[j])
j += 1
count[element] += max(multiplier, 1)
i = j
return i, count
_, counts = parse_formula(0)
sorted_elements = sorted(counts.items())
result = []
for element, count in sorted_elements:
result.append(element)
if count > 1:
result.append(str(count))
return ''.join(result)