SQL: Calendar Application Events Report 2
SELECT
e.dt,
e.title,
GROUP_CONCAT(CONCAT(g.full_name, ' <', g.email_address, '>') ORDER BY g.full_name SEPARATOR ', ') AS guests
FROM
events e
JOIN
events_guests eg ON e.id = eg.event_id
JOIN
guests g ON eg.guest_id = g.id
WHERE
g.on_vacation = 0
GROUP BY
e.id, e.dt, e.title
ORDER BY
e.dt ASC
LIMIT 5;
๐1
def getMinCores(start, end):
events = [(t, 1) for t in start] + [(t, -1) for t in end]
events.sort(key=lambda x: (x[0], -x[1]))
max_cores = 0
current_cores = 0
for time, event_type in events:
if event_type == 1:
current_cores += 1
else:
current_cores -= 1
max_cores = max(max_cores, current_cores)
return max_cores
Process Scheduler โ
events = [(t, 1) for t in start] + [(t, -1) for t in end]
events.sort(key=lambda x: (x[0], -x[1]))
max_cores = 0
current_cores = 0
for time, event_type in events:
if event_type == 1:
current_cores += 1
else:
current_cores -= 1
max_cores = max(max_cores, current_cores)
return max_cores
Process Scheduler โ
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
#include <iostream>
#include <vector>
#include <unordered_map>
#include <algorithm>
const int MOD = 1000000007;
using namespace std;
void dfs(int node, const unordered_map<int, vector<pair<int, int>>>& tree, vector<long long>& magnitudes) {
auto it = tree.find(node);
if (it != tree.end()) {
for (const auto& neighbor : it->second) {
int next_node = neighbor.first;
int weight = neighbor.second;
magnitudes[next_node] = (magnitudes[node] * weight) % MOD;
dfs(next_node, tree, magnitudes);
}
}
}
vector<int> findEquivalentMagnitude(int unit_nodes, vector<int> unit_from, vector<int> unit_to, vector<int> unit_weight, int x) {
unordered_map<int, vector<pair<int, int>>> tree;
for (int i = 0; i < unit_from.size(); ++i) {
tree[unit_from[i]].emplace_back(unit_to[i], unit_weight[i]);
}
vector<long long> magnitudes(unit_nodes + 1, -1);
magnitudes[1] = x;
dfs(1, tree, magnitudes);
vector<int> result(unit_nodes);
for (int i = 1; i <= unit_nodes; ++i) {
result[i - 1] = magnitudes[i];
}
return result;
}
#include <vector>
#include <unordered_map>
#include <algorithm>
const int MOD = 1000000007;
using namespace std;
void dfs(int node, const unordered_map<int, vector<pair<int, int>>>& tree, vector<long long>& magnitudes) {
auto it = tree.find(node);
if (it != tree.end()) {
for (const auto& neighbor : it->second) {
int next_node = neighbor.first;
int weight = neighbor.second;
magnitudes[next_node] = (magnitudes[node] * weight) % MOD;
dfs(next_node, tree, magnitudes);
}
}
}
vector<int> findEquivalentMagnitude(int unit_nodes, vector<int> unit_from, vector<int> unit_to, vector<int> unit_weight, int x) {
unordered_map<int, vector<pair<int, int>>> tree;
for (int i = 0; i < unit_from.size(); ++i) {
tree[unit_from[i]].emplace_back(unit_to[i], unit_weight[i]);
}
vector<long long> magnitudes(unit_nodes + 1, -1);
magnitudes[1] = x;
dfs(1, tree, magnitudes);
vector<int> result(unit_nodes);
for (int i = 1; i <= unit_nodes; ++i) {
result[i - 1] = magnitudes[i];
}
return result;
}
int findMaxUses(vector<int>& costs, vector<int>& uses, int budget) {
int n = costs.size();
if (n < 2) {
return -1;
}
vector<pair<int, int>> ft;
for (int i = 0; i < n; ++i) {
ft.push_back({costs[i], uses[i]});
}
sort(ft.begin(), ft.end());
int mu = -1;
for (int i = 0; i < n; ++i) {
for (int j = i + 1; j < n; ++j) {
int tc = ft[i].first + ft[j].first;
if (tc <= budget) {
int bg = ft[i].second + ft[j].second;
mu = max(mu, bg);
} else {
break;
}
}
}
return mu;
}
DE Shaw โ
int n = costs.size();
if (n < 2) {
return -1;
}
vector<pair<int, int>> ft;
for (int i = 0; i < n; ++i) {
ft.push_back({costs[i], uses[i]});
}
sort(ft.begin(), ft.end());
int mu = -1;
for (int i = 0; i < n; ++i) {
for (int j = i + 1; j < n; ++j) {
int tc = ft[i].first + ft[j].first;
if (tc <= budget) {
int bg = ft[i].second + ft[j].second;
mu = max(mu, bg);
} else {
break;
}
}
}
return mu;
}
DE Shaw โ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Almabase is hiring for Frontend engineering intern- Remote
Batch: 2024/2025/2026/2027
Stipend: โน40,000
Apply here: https://wellfound.com/l/2AoQyy
Batch: 2024/2025/2026/2027
Stipend: โน40,000
Apply here: https://wellfound.com/l/2AoQyy
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Bizup is hiring for Software Development Engineer
Expected Salary: 5-10 LPA
Apply here:
https://expertia.ai/bizup-app/job/hiring-software-development-engineer-65cd9bdd6146d4c2bb817876?easy_apply=true&date-refresh=07/10/2024
Expected Salary: 5-10 LPA
Apply here:
https://expertia.ai/bizup-app/job/hiring-software-development-engineer-65cd9bdd6146d4c2bb817876?easy_apply=true&date-refresh=07/10/2024
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
ReachInbox is hiring for Frontend Engineer
Expected Salary: 25k-35k per month
Apply here:
https://careers.outbox.vc/associate-frontend-engineer-179835/
Expected Salary: 25k-35k per month
Apply here:
https://careers.outbox.vc/associate-frontend-engineer-179835/
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Unomok is hiring for Machine Learning Engineer - Intern
Expected Stipend: 15K-50K per month
Apply here:
https://wellfound.com/jobs/3053954-machine-learning-engineer-intern
Expected Stipend: 15K-50K per month
Apply here:
https://wellfound.com/jobs/3053954-machine-learning-engineer-intern
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Vance is hiring for Backend Engineering Intern
Expected Stipend: 4-8 LPA
Apply here:
https://jobs.ashbyhq.com/Vance/99886987-e912-4c24-bddc-a0802c028e53
Expected Stipend: 4-8 LPA
Apply here:
https://jobs.ashbyhq.com/Vance/99886987-e912-4c24-bddc-a0802c028e53
WITH monthly_sales AS (
SELECT mon, SUM(amount) as month_total
FROM sales
GROUP BY mon
),
cumulative_sales AS (
SELECT mon,
SUM(month_total) OVER (ORDER BY mon ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) as total_sales_so_far
FROM monthly_sales
)
SELECT ms.mon,
ROUND(ms.month_total * 100.0 / cs.total_sales_so_far, 0) AS sales_percent
FROM monthly_sales ms
JOIN cumulative_sales cs ON ms.mon = cs.mon
WHERE ms.mon > 1 AND ROUND(ms.month_total * 100.0 / cs.total_sales_so_far, 0) >= 20
ORDER BY ms.mon;
Sales percent โ
๐1
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s=sc.next();
int n=s.length(),i;
double dp[][]=new double[n+1][2];
dp[0][0]=0;
dp[0][1]=1;
double a[][]=new double[n][2];
for(i=1;i<=n;i++){
if(s.charAt(i-1)=='L'){
dp[i][0]=dp[i-1][0];
dp[i][1]=(double)(dp[i-1][0]+dp[i-1][1])/2;
a[i-1][0]=dp[i][1];
a[i-1][1]=(double)i;
}
else{
dp[i][1]=dp[i-1][1];
dp[i][0]=(double)(dp[i-1][0]+dp[i-1][1])/2;
a[i-1][0]=dp[i][0];
a[i-1][1]=(double)i;
}
}
Arrays.sort(a,(x,y)->Double.compare(x[0],y[0]));
int ans[]=new int[n];
for(i=0;i<n;i++) ans[i]=(int)a[i][1];
System.out.println(Arrays.toString(ans));
}
}
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s=sc.next();
int n=s.length(),i;
double dp[][]=new double[n+1][2];
dp[0][0]=0;
dp[0][1]=1;
double a[][]=new double[n][2];
for(i=1;i<=n;i++){
if(s.charAt(i-1)=='L'){
dp[i][0]=dp[i-1][0];
dp[i][1]=(double)(dp[i-1][0]+dp[i-1][1])/2;
a[i-1][0]=dp[i][1];
a[i-1][1]=(double)i;
}
else{
dp[i][1]=dp[i-1][1];
dp[i][0]=(double)(dp[i-1][0]+dp[i-1][1])/2;
a[i-1][0]=dp[i][0];
a[i-1][1]=(double)i;
}
}
Arrays.sort(a,(x,y)->Double.compare(x[0],y[0]));
int ans[]=new int[n];
for(i=0;i<n;i++) ans[i]=(int)a[i][1];
System.out.println(Arrays.toString(ans));
}
}
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
vector<int> findNumberSequence(const string& direction) {
int n = direction.size();
vector<int> result((1 << n), -1);
int lower = 0;
int higher = (1 << n) - 1;
for (int i = 0; i < n; i++) {
int center = (lower + higher) / 2;
result[center] = i + 1;
if (direction[i] == 'L') {
higher = center - 1;
} else {
lower = center + 1;
}
}
result.erase(remove(result.begin(), result.end(), -1), result.end());
return result;
}
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
vector<int> findNumberSequence(const string& direction) {
int n = direction.size();
vector<int> result((1 << n), -1);
int lower = 0;
int higher = (1 << n) - 1;
for (int i = 0; i < n; i++) {
int center = (lower + higher) / 2;
result[center] = i + 1;
if (direction[i] == 'L') {
higher = center - 1;
} else {
lower = center + 1;
}
}
result.erase(remove(result.begin(), result.end(), -1), result.end());
return result;
}
๐1