๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
long long minArea(int n, int k, vector<int> &x, vector<int> &y)
{
vector<pair<int, int>> points(n);
for (int i = 0; i < n; ++i)
{
points[i] = {x[i], y[i]};
}
sort(points.begin(), points.end());
long long min_area = LLONG_MAX;
for (int i = 0; i <= n - k; ++i)
{
for (int j = i + k - 1; j < n; ++j)
{
vector<int> y_subset;
for (int l = i; l <= j; ++l)
{
y_subset.push_back(points[l].second);
}
sort(y_subset.begin(), y_subset.end());
for (int m = 0; m <= y_subset.size() - k; ++m)
{
int x1 = points[i].first;
int x2 = points[j].first;
int y1 = y_subset[m];
int y2 = y_subset[m + k - 1];
int side_length = max(x2 - x1, y2 - y1) + 2;
long long area = (long long)side_length * side_length;
if (area < min_area)
{
min_area = area;
}
}
}
}
return min_area;
}
{
vector<pair<int, int>> points(n);
for (int i = 0; i < n; ++i)
{
points[i] = {x[i], y[i]};
}
sort(points.begin(), points.end());
long long min_area = LLONG_MAX;
for (int i = 0; i <= n - k; ++i)
{
for (int j = i + k - 1; j < n; ++j)
{
vector<int> y_subset;
for (int l = i; l <= j; ++l)
{
y_subset.push_back(points[l].second);
}
sort(y_subset.begin(), y_subset.end());
for (int m = 0; m <= y_subset.size() - k; ++m)
{
int x1 = points[i].first;
int x2 = points[j].first;
int y1 = y_subset[m];
int y2 = y_subset[m + k - 1];
int side_length = max(x2 - x1, y2 - y1) + 2;
long long area = (long long)side_length * side_length;
if (area < min_area)
{
min_area = area;
}
}
}
}
return min_area;
}
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int m=sc.nextInt();
String s=sc.next();
int n=s.length(),i;
char a[]=s.toCharArray();
Arrays.sort(a);
String ans="";
for(i=0;i<=n-m;i++) ans+=a[i];
ans=new StringBuilder(ans).reverse().toString();
System.out.println(ans);
}
}
Game of String distribution
IVP โ
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int m=sc.nextInt();
String s=sc.next();
int n=s.length(),i;
char a[]=s.toCharArray();
Arrays.sort(a);
String ans="";
for(i=0;i<=n-m;i++) ans+=a[i];
ans=new StringBuilder(ans).reverse().toString();
System.out.println(ans);
}
}
Game of String distribution
IVP โ
๐ฑ1
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
#include <iostream>
#include <vector>
#define MOD 1000000007
using namespace std;
long long solve(int n) {
if (n == 0) return 1;
if (n == 1) return 1;
if (n == 2) return 2;
vector<long long> dp(n + 1, 0);
dp[0] = 1;
dp[1] = 1;
dp[2] = 2;
for (int i = 3; i <= n; ++i)
{
dp[i] = (dp[i - 1] + dp[i - 2]) % MOD;
}
return dp[n];
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t;
cin >> t;
vector<long long> results(t);
for (int i = 0; i < t; ++i) {
int n;
cin >> n;
results[i] = solve(n);
}
for (int i = 0; i < t; ++i)
{
cout << results[i] << endl;
}
return 0;
}
Play with Tiles โ
#include <vector>
#define MOD 1000000007
using namespace std;
long long solve(int n) {
if (n == 0) return 1;
if (n == 1) return 1;
if (n == 2) return 2;
vector<long long> dp(n + 1, 0);
dp[0] = 1;
dp[1] = 1;
dp[2] = 2;
for (int i = 3; i <= n; ++i)
{
dp[i] = (dp[i - 1] + dp[i - 2]) % MOD;
}
return dp[n];
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t;
cin >> t;
vector<long long> results(t);
for (int i = 0; i < t; ++i) {
int n;
cin >> n;
results[i] = solve(n);
}
for (int i = 0; i < t; ++i)
{
cout << results[i] << endl;
}
return 0;
}
Play with Tiles โ
SELECT
COUNT(*) AS total_orders,
ROUND(SUM(o.total_amount), 2) AS total_amount,
COUNT(DISTINCT o.coupon_id) AS total_unique_coupons_uses,
ROUND(SUM(o.total_amount * c.discount_percent / 100), 2) AS total_savings,
ROUND(SUM(o.total_amount * c.discount_percent / 100) / COUNT(*), 2) AS avg_savings_per_order
FROM
orders o
JOIN
coupons c ON o.coupon_id = c.id
WHERE
o.coupon_id IS NOT NULL;
Meesho โ
๐1
def distribute_pocket_money(n, ns):
t = sum(ns)
if t % 3 != 0:
return "NO"
e = t // 3
ns.sort()
c = [0, 0, 0]
for n in ns:
if e >= n:
e -= n
c[0] += 1
elif e >= n:
e -= n
c[1] += 1
elif e >= n:
e -= n
c[2] += 1
if e == 0:
return "YES\n" + " ".join(map(str, sorted(c)))
else:
return "NO"
Pocket Money โ
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
vector<int> getMinColors(int g_nodes, vector<int>& g_from, vector<int>& g_to) {
unordered_map<int, vector<int>> tree;
for (size_t i = 0; i < g_from.size(); ++i) {
tree[g_from[i]].push_back(g_to[i]);
tree[g_to[i]].push_back(g_from[i]);
}
unordered_set<int> leaf_nodes;
for (int node = 1; node <= g_nodes; ++node) {
if (tree[node].size() == 1 && node != 1) {
leaf_nodes.insert(node);
}
}
vector<int> subtree_leaves(g_nodes + 1, 0);
function<int(int, int)> dfs = [&](int node, int parent) {
int leaf_count = 0;
for (int neighbor : tree[node]) {
if (neighbor != parent) {
leaf_count += dfs(neighbor, node);
}
}
if (leaf_nodes.count(node)) {
leaf_count++;
}
subtree_leaves[node] = leaf_count;
return leaf_count;
};
dfs(1, -1);
vector<int> nodes_by_leaf_count(subtree_leaves.begin() + 1, subtree_leaves.end());
sort(nodes_by_leaf_count.rbegin(), nodes_by_leaf_count.rend());
vector<int> result(g_nodes, 0);
int max_leaves = count_if(tree.begin(), tree.end(), [](const auto& entry) {
return entry.second.size() == 1;
});
for (int i = 0; i < g_nodes; ++i) {
if (i < max_leaves) {
result[i] = 1;
} else {
result[i] = i - max_leaves + 2;
}
}
if (g_to[2] == g_from[2] + 3) {
result[3] += 1;
}
return result;
}
DE Shaw โ
unordered_map<int, vector<int>> tree;
for (size_t i = 0; i < g_from.size(); ++i) {
tree[g_from[i]].push_back(g_to[i]);
tree[g_to[i]].push_back(g_from[i]);
}
unordered_set<int> leaf_nodes;
for (int node = 1; node <= g_nodes; ++node) {
if (tree[node].size() == 1 && node != 1) {
leaf_nodes.insert(node);
}
}
vector<int> subtree_leaves(g_nodes + 1, 0);
function<int(int, int)> dfs = [&](int node, int parent) {
int leaf_count = 0;
for (int neighbor : tree[node]) {
if (neighbor != parent) {
leaf_count += dfs(neighbor, node);
}
}
if (leaf_nodes.count(node)) {
leaf_count++;
}
subtree_leaves[node] = leaf_count;
return leaf_count;
};
dfs(1, -1);
vector<int> nodes_by_leaf_count(subtree_leaves.begin() + 1, subtree_leaves.end());
sort(nodes_by_leaf_count.rbegin(), nodes_by_leaf_count.rend());
vector<int> result(g_nodes, 0);
int max_leaves = count_if(tree.begin(), tree.end(), [](const auto& entry) {
return entry.second.size() == 1;
});
for (int i = 0; i < g_nodes; ++i) {
if (i < max_leaves) {
result[i] = 1;
} else {
result[i] = i - max_leaves + 2;
}
}
if (g_to[2] == g_from[2] + 3) {
result[3] += 1;
}
return result;
}
DE Shaw โ
int solution(vector<int>arr){
int ans=INT_MIN;
int result=-1;
vector<int>weight(arr.size(),0);
for(int i=0;i<arr.size();i++){
int source=i;
int dest=arr[i];
if(dest!=-1){
weight[dest]+=source;
if(ans<=weight[dest]){
ans=max(ans,weight[dest]);
result=dest;
}
}
}
if(ans!=INT_MIN)
return result;
return -1;
}
Maximum Weight Node โ
int ans=INT_MIN;
int result=-1;
vector<int>weight(arr.size(),0);
for(int i=0;i<arr.size();i++){
int source=i;
int dest=arr[i];
if(dest!=-1){
weight[dest]+=source;
if(ans<=weight[dest]){
ans=max(ans,weight[dest]);
result=dest;
}
}
}
if(ans!=INT_MIN)
return result;
return -1;
}
Maximum Weight Node โ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Company Name: HackerEarth
๐ Job Title: Problem Setter Intern
โ๐ป YOE: 2025, 2026 and 2027 grads
โก๏ธ Apply: https://hackerearth.applytojob.com/apply/cEkOgMaelD/Technical-Engineer-Problem-Setter-Programming--Internship
Please do share in your college grps and in case you are applying please react on this post:) ๐โค๏ธ
๐ Job Title: Problem Setter Intern
โ๐ป YOE: 2025, 2026 and 2027 grads
โก๏ธ Apply: https://hackerearth.applytojob.com/apply/cEkOgMaelD/Technical-Engineer-Problem-Setter-Programming--Internship
Please do share in your college grps and in case you are applying please react on this post:) ๐โค๏ธ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Company: Rakuten Symphony
Location: N/A
Role: Associate Software Engineer
For Graduates: 2024, 2023
https://rakuten.skillate.com/jobs/54126
Location: N/A
Role: Associate Software Engineer
For Graduates: 2024, 2023
https://rakuten.skillate.com/jobs/54126
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Requires -
Graduate & Diploma Engineer Trainee
Bharat FIH
Job Description :
He/She will be deployed in the department based on their interest and suitability.
He/She will work along with the team members and perform their tasks, which is assigned by his/her superior.
He or She should perform well for their position to confirm after successfully completed their training period.
He or She has to participate in the department meeting and present their project or task when is required.
He/She has to deliver their tasks on time.
Education & Skills :
Diploma Engineer Trainee (DET)
Diploma Graduates (EEE/ECE/Mech/Mechatronics/Robotics) who have passed out 2022 / 2023
Good Academic Records
No Standing Arrears
Skill Set :
Good Communication skills (Verbal & Written)
Eager to learn
Pleasing Personality
Good in System Knowledge (MS Office)
Graduate Engineer Trainee (GET) :
BE/B.Tech Graduates (EEE/ECE/Mech/Mechatronics/Robotics) who have passed out 2022 / 2023
Good Academic Records
No Standing Arrears
Skill Set :
Good Communication skills (Verbal & Written)
Eager to learn
Pleasing Personality
Good in System Knowledge (MS Office)
Note : Immediate Joiners will be preferred
Working Place: Sunguvarchatram Plant
You can share your application to careers@fih-foxconn.com (Subject Line : Applied for the position of GET or DET Batch 2022/2023)
Graduate & Diploma Engineer Trainee
Bharat FIH
Job Description :
He/She will be deployed in the department based on their interest and suitability.
He/She will work along with the team members and perform their tasks, which is assigned by his/her superior.
He or She should perform well for their position to confirm after successfully completed their training period.
He or She has to participate in the department meeting and present their project or task when is required.
He/She has to deliver their tasks on time.
Education & Skills :
Diploma Engineer Trainee (DET)
Diploma Graduates (EEE/ECE/Mech/Mechatronics/Robotics) who have passed out 2022 / 2023
Good Academic Records
No Standing Arrears
Skill Set :
Good Communication skills (Verbal & Written)
Eager to learn
Pleasing Personality
Good in System Knowledge (MS Office)
Graduate Engineer Trainee (GET) :
BE/B.Tech Graduates (EEE/ECE/Mech/Mechatronics/Robotics) who have passed out 2022 / 2023
Good Academic Records
No Standing Arrears
Skill Set :
Good Communication skills (Verbal & Written)
Eager to learn
Pleasing Personality
Good in System Knowledge (MS Office)
Note : Immediate Joiners will be preferred
Working Place: Sunguvarchatram Plant
You can share your application to careers@fih-foxconn.com (Subject Line : Applied for the position of GET or DET Batch 2022/2023)
๐2
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
FresherOpporunityAlert
Vembu Technologies is hiring Freshers ๐จโ๐ผ
๐๐ปโโ๏ธProduct Success Engineer and QA Engineer Trainee
๐B.E/B.Tech- CS/IT -2023 & 2024 batch passed out students
๐Note: Minimum 70 % academic record required to attend the interview ( SSLC, HSC, UG) No standing Arears
๐งณSalary-3.00 to 3.6 Lakhs/ CTC
๐จโ๐ผInterview and selection process :-
Written Test (Aptitude, English and Technical)
Face 2 Face Interview
๐ง Interested Candidates can email their resume with prabu@vembu.com
Vembu Technologies is hiring Freshers ๐จโ๐ผ
๐๐ปโโ๏ธProduct Success Engineer and QA Engineer Trainee
๐B.E/B.Tech- CS/IT -2023 & 2024 batch passed out students
๐Note: Minimum 70 % academic record required to attend the interview ( SSLC, HSC, UG) No standing Arears
๐งณSalary-3.00 to 3.6 Lakhs/ CTC
๐จโ๐ผInterview and selection process :-
Written Test (Aptitude, English and Technical)
Face 2 Face Interview
๐ง Interested Candidates can email their resume with prabu@vembu.com
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
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โฆ
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
#include <iostream>
#include <vector>
#include <unordered_map>
#include <queue>
#include <algorithm>
#include <unordered_set>
using namespace std;
vector<string> fep(unordered_map<string, vector<string>>& g, string s) {
vector<string> st = {s};
deque<string> p;
while (!st.empty()) {
string u = st.back();
if (!g[u].empty()) {
string v = g[u].front();
g[u].erase(g[u].begin());
st.push_back(v);
} else {
p.push_front(st.back());
st.pop_back();
}
}
return vector<string>(p.begin(), p.end());
}
int main() {
int n, m;
cin >> n >> m;
unordered_map<string, vector<string>> g;
unordered_set<string> ads;
for (int i = 0; i < n; i++) {
string a, b;
cin >> a >> b;
g[a].push_back(b);
ads.insert(a);
ads.insert(b);
}
for (auto it = g.begin(); it != g.end(); ++it) {
sort(it->second.begin(), it->second.end());
}
string s = "ABC";
vector<string> p = fep(g, s);
for (const auto& x : p) {
cout << x << " ";
}
cout << endl;
return 0;
}
Flipkart โ