5_6185721700538128004.pdf
486.7 KB
Interview Questions & Answer For Freshers
November 18, 2024
Cognizant Hiring For Process Executive
Experience: Freshers / Experience
Education: Any Graduate
Salary: 11 LPA (Expected)
Apply:- www.itjobs.services
Experience: Freshers / Experience
Education: Any Graduate
Salary: 11 LPA (Expected)
Apply:- www.itjobs.services
November 19, 2024
Zoho Hiring QA Engineer
Experience: Freshers / Experience
Education: Any Graduate
Salary: 7 LPA (Expected)
Apply:- www.itjobs.services
Experience: Freshers / Experience
Education: Any Graduate
Salary: 7 LPA (Expected)
Apply:- www.itjobs.services
November 21, 2024
Flipkart | MSI Katana 15 Intel Core i7 13th Gen Gaming Laptop At Rs.76,590
Link : https://fkrt.co/iaSUQ0
Link : https://fkrt.co/iaSUQ0
November 21, 2024
November 22, 2024
Company : Cognizant
Roles : Software Engineer
Qualification : Bachelor’s degree
Location : Hybrid Bangalore
Experience 0 - 3 years
Batches : 2024 - 2018
Salary3 lpa - 8 lpa
Apply Now:- www.itjobs.services
Roles : Software Engineer
Qualification : Bachelor’s degree
Location : Hybrid Bangalore
Experience 0 - 3 years
Batches : 2024 - 2018
Salary3 lpa - 8 lpa
Apply Now:- www.itjobs.services
November 23, 2024
Adobe is hiring for Software Development Engineer Role
*Role: Software Development Engineer
*Location:Noida, IN
*Category: Software Engineering
Employment Type: Full-time
Apply Now:- http://www.itjobs.services/2024/11/adobe-is-hiring-for-software.html
*Role: Software Development Engineer
*Location:Noida, IN
*Category: Software Engineering
Employment Type: Full-time
Apply Now:- http://www.itjobs.services/2024/11/adobe-is-hiring-for-software.html
November 25, 2024
November 26, 2024
Goldman Sachs hiring Software Engineer
1-2 year experience
10-18 LPA CTC
Apply Here : https://cuvette.tech/app/other-jobs/673cc314696098e85b3222b0?referralCode=O1NSKE
1-2 year experience
10-18 LPA CTC
Apply Here : https://cuvette.tech/app/other-jobs/673cc314696098e85b3222b0?referralCode=O1NSKE
November 27, 2024
FairCloud AI is hiring for Software Engineer Intern
Experience: 0 - 1 year
Stipend: coompetitive
Apply here: https://www.linkedin.com/jobs/view/4082269421/?alternateChannel=search
Experience: 0 - 1 year
Stipend: coompetitive
Apply here: https://www.linkedin.com/jobs/view/4082269421/?alternateChannel=search
November 27, 2024
Job and Internships:
https://cuvette.tech/app/student/internship/6745c96f4f16f90195bcd183
https://cuvette.tech/app/student/job/6745d306dc08d34ef7e33d35
https://wellfound.com/jobs/3132271-product-engineer-2024-grads?utm_campaign=linkedin_syndication&utm_source=linkedin
https://www.ycombinator.com/companies/swipe-2/jobs/vprs8lO-android-intern-onsite-hyderabad?utm_source=syn_li
https://careers.gehealthcare.com/global/en/job/GEVGHLGLOBALR4012888EXTERNALENGLOBAL/Software-Intern?utm_source=linkedin&utm_medium=phenom-feeds
https://womennovators.com/we/career/details/32
https://app.dover.com/apply/Deccan%20AI/e67320d5-5160-4f8c-abc5-3c6251bf103d?rs=42706078
https://job-boards.greenhouse.io/myntra/jobs/7727819002?gh_src=bb272d8c2
1+year
https://krb-sjobs.brassring.com/TGnewUI/Search/home/HomeWithPreLoad?partnerid=26059&siteid=5016&PageType=JobDetails&jobid=767733
https://tnl2.jometer.com/v2/job?jz=5wqzs50b3b2c490247aecf949e0fc6edbc889CMALBBQAAADQ&iis=Job%20Board%20-%20Recruitment%20Marketing&iisn=LinkedIn
https://app.greenhouse.io/embed/job_app?token=7204917002&gh_src=wd1vhf
https://careers.abb/global/en/job/ABB1GLOBAL94273475EXTERNALENGLOBAL/Associate-Software-Engineer?utm_source=linkedin&utm_medium=phenom-feeds
https://assaabloy.jobs2web.com/job/Chennai-Associate-Web-Developer-600-032/1144953201/
https://autodesk.wd1.myworkdayjobs.com/uni/job/Singapore-SGP/Software-Development-Engineer_24WD83728?src=JB-10065&source=LinkedIn
https://usource.ripplehire.com/candidate/?token=8YxWjpwDhdL62DFYUIcQ&lang=en&source=USTLINKEDIN&ref=USTLINKEDIN#detail/job/28532
https://alphawave.wd10.myworkdayjobs.com/Alphawave_External/job/Bangalore/VLSI-Trained-Fresher_JR100605?source=LinkedIn
referral required
https://www.linkedin.com/posts/pramodmg_myntra-softwareengineer-hiring-activity-7267757354119495681-8aMk?utm_source=share&utm_medium=member_desktop
https://careers.sasken.com/job/ENGINEER-SOFTWARE-TEST&RELEASE/30519544/
https://careers.ey.com/ey/job/CABA-Client-Technology-SAP-Infrastructure-24x5-Setup-SAP-Basis-Infrastructure-Engineer-EY-GDS-B-1001/1024675101/
https://docs.google.com/forms/d/e/1FAIpQLSdtj-fmGQxITulW_qAYRYkugjCWH--NAZW0U9YxfolocQb3ZQ/viewform
https://cuvette.tech/app/student/internship/6745c96f4f16f90195bcd183
https://cuvette.tech/app/student/job/6745d306dc08d34ef7e33d35
https://wellfound.com/jobs/3132271-product-engineer-2024-grads?utm_campaign=linkedin_syndication&utm_source=linkedin
https://www.ycombinator.com/companies/swipe-2/jobs/vprs8lO-android-intern-onsite-hyderabad?utm_source=syn_li
https://careers.gehealthcare.com/global/en/job/GEVGHLGLOBALR4012888EXTERNALENGLOBAL/Software-Intern?utm_source=linkedin&utm_medium=phenom-feeds
https://womennovators.com/we/career/details/32
https://app.dover.com/apply/Deccan%20AI/e67320d5-5160-4f8c-abc5-3c6251bf103d?rs=42706078
https://job-boards.greenhouse.io/myntra/jobs/7727819002?gh_src=bb272d8c2
1+year
https://krb-sjobs.brassring.com/TGnewUI/Search/home/HomeWithPreLoad?partnerid=26059&siteid=5016&PageType=JobDetails&jobid=767733
https://tnl2.jometer.com/v2/job?jz=5wqzs50b3b2c490247aecf949e0fc6edbc889CMALBBQAAADQ&iis=Job%20Board%20-%20Recruitment%20Marketing&iisn=LinkedIn
https://app.greenhouse.io/embed/job_app?token=7204917002&gh_src=wd1vhf
https://careers.abb/global/en/job/ABB1GLOBAL94273475EXTERNALENGLOBAL/Associate-Software-Engineer?utm_source=linkedin&utm_medium=phenom-feeds
https://assaabloy.jobs2web.com/job/Chennai-Associate-Web-Developer-600-032/1144953201/
https://autodesk.wd1.myworkdayjobs.com/uni/job/Singapore-SGP/Software-Development-Engineer_24WD83728?src=JB-10065&source=LinkedIn
https://usource.ripplehire.com/candidate/?token=8YxWjpwDhdL62DFYUIcQ&lang=en&source=USTLINKEDIN&ref=USTLINKEDIN#detail/job/28532
https://alphawave.wd10.myworkdayjobs.com/Alphawave_External/job/Bangalore/VLSI-Trained-Fresher_JR100605?source=LinkedIn
referral required
https://www.linkedin.com/posts/pramodmg_myntra-softwareengineer-hiring-activity-7267757354119495681-8aMk?utm_source=share&utm_medium=member_desktop
https://careers.sasken.com/job/ENGINEER-SOFTWARE-TEST&RELEASE/30519544/
https://careers.ey.com/ey/job/CABA-Client-Technology-SAP-Infrastructure-24x5-Setup-SAP-Basis-Infrastructure-Engineer-EY-GDS-B-1001/1024675101/
https://docs.google.com/forms/d/e/1FAIpQLSdtj-fmGQxITulW_qAYRYkugjCWH--NAZW0U9YxfolocQb3ZQ/viewform
November 28, 2024
Capstoneco Hiring
Summer Internship
Batch: 2025/2026
Location: London, New York
Duration: 10 Weeks
Apply now:- https://www.itjobs.services/2024/11/capstoneco-hiring.html
Summer Internship
Batch: 2025/2026
Location: London, New York
Duration: 10 Weeks
Apply now:- https://www.itjobs.services/2024/11/capstoneco-hiring.html
November 28, 2024
#include<stdio.h>
int main()
{
int n;
scanf("%d",&n);
int arr[n];
for(int i=0;i<n;i++)
{
scanf("%d",&arr[i]);
}
int count=0;
int num=arr[0];
for(int i=1;i<n;i++)
{
if(num!=arr[i])
count++;
}
printf("%d",count);
}
C Language
TCS 1st Qsn
---------------------------------------------------------
N=int(input())
K=int(input())
price=list(map(int,input().split()))
vol=list(map(int,input().split()))
maxvol=0
volu=0
maxvol=max(vol)
for i in range(0,N):
if (maxvol==vol[i] and price[i]<=K):
K=K-price[i]
volu=maxvol
for i in range(0,N):
for j in range(i+1,N+1):
if (price[i]<=K and price[i]==price[j]):
if (vol[i]>vol[j]):
volu=volu+vol[i]
K=K-price[i]
else:
volu=volu+vol[j]
K=K-price[j]
elif (price[i]<=K and price[i]!=price[j]):
K=K-price[i]
-------
include<stdio.h>
int main()
{
int n;
scanf("%d",&n);
int arr[n];
for(int i=0;i<n;i++)
{
scanf("%d",&arr[i]);
}
int count=0;
int num=arr[0];
for(int i=1;i<n;i++)
{
if(num!=arr[i])
count++;
}
printf("%d",count);
}
Array Code in C language
int main()
{
int n;
scanf("%d",&n);
int arr[n];
for(int i=0;i<n;i++)
{
scanf("%d",&arr[i]);
}
int count=0;
int num=arr[0];
for(int i=1;i<n;i++)
{
if(num!=arr[i])
count++;
}
printf("%d",count);
}
C Language
TCS 1st Qsn
---------------------------------------------------------
N=int(input())
K=int(input())
price=list(map(int,input().split()))
vol=list(map(int,input().split()))
maxvol=0
volu=0
maxvol=max(vol)
for i in range(0,N):
if (maxvol==vol[i] and price[i]<=K):
K=K-price[i]
volu=maxvol
for i in range(0,N):
for j in range(i+1,N+1):
if (price[i]<=K and price[i]==price[j]):
if (vol[i]>vol[j]):
volu=volu+vol[i]
K=K-price[i]
else:
volu=volu+vol[j]
K=K-price[j]
elif (price[i]<=K and price[i]!=price[j]):
K=K-price[i]
-------
include<stdio.h>
int main()
{
int n;
scanf("%d",&n);
int arr[n];
for(int i=0;i<n;i++)
{
scanf("%d",&arr[i]);
}
int count=0;
int num=arr[0];
for(int i=1;i<n;i++)
{
if(num!=arr[i])
count++;
}
printf("%d",count);
}
Array Code in C language
November 29, 2024
November 29, 2024
int main() {
int n, m, k, d = 1, rv = 0;
cin >> n >> m;
vector<set<int>> f(n);
for (int i = 0, u, v; i < m; ++i) {
cin >> u >> v;
f[u].insert(v);
f[v].insert(u);
}
cin >> k;
vector<bool> w(n, true);
rv = n;
while (rv < k) {
vector<bool> nw(n, false);
for (int i = 0; i < n; ++i) {
int cnt = 0;
for (int fr : f[i]) cnt += w[fr];
if (w[i] && cnt == 3) nw[i] = true;
else if (!w[i] && cnt < 3) nw[i] = true;
}
w = nw;
rv += count(w.begin(), w.end(), true);
++d;
}
cout << d;
return 0;
}
Office Rostering
C+
TCS exam
int n, m, k, d = 1, rv = 0;
cin >> n >> m;
vector<set<int>> f(n);
for (int i = 0, u, v; i < m; ++i) {
cin >> u >> v;
f[u].insert(v);
f[v].insert(u);
}
cin >> k;
vector<bool> w(n, true);
rv = n;
while (rv < k) {
vector<bool> nw(n, false);
for (int i = 0; i < n; ++i) {
int cnt = 0;
for (int fr : f[i]) cnt += w[fr];
if (w[i] && cnt == 3) nw[i] = true;
else if (!w[i] && cnt < 3) nw[i] = true;
}
w = nw;
rv += count(w.begin(), w.end(), true);
++d;
}
cout << d;
return 0;
}
Office Rostering
C+
TCS exam
November 29, 2024
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
using namespace std;
struct Line {
int x1, y1, x2, y2;
};
int countCells(Line line, pair<int, int> star, bool split) {
if (line.x1 == line.x2) {
if (split) {
return min(abs(star.second - line.y1), abs(star.second - line.y2)) + 1;
}
else {
return abs(line.y1 - line.y2) + 1;
}
}
else {
if (split) {
return min(abs(star.first - line.x1), abs(star.first - line.x2)) + 1;
}
else {
return abs(line.x1 - line.x2) + 1;
}
}
}
bool intersects(Line a, Line b, pair<int, int>& intersection) {
if (a.x1 == a.x2 && b.y1 == b.y2) {
if (b.x1 <= a.x1 && a.x1 <= b.x2 && a.y1 <= b.y1 && b.y1 <= a.y2) {
intersection = {a.x1, b.y1};
return true;
}
}
if (a.y1 == a.y2 && b.x1 == b.x2) {
if (a.x1 <= b.x1 && b.x1 <= a.x2 && b.y1 <= a.y1 && a.y1 <= b.y2) {
intersection = {b.x1, a.y1};
return true;
}
}
return false;
}
int main() {
int N, K;
cin >> N;
vector<Line> lines(N);
for (int i = 0; i < N; ++i) {
cin >> lines[i].x1 >> lines[i].y1 >> lines[i].x2 >> lines[i].y2;
if (lines[i].x1 > lines[i].x2 || (lines[i].x1 == lines[i].x2 && lines[i].y1 > lines[i].y2)) {
swap(lines[i].x1, lines[i].x2);
swap(lines[i].y1, lines[i].y2);
}
}
cin >> K;
map<pair<int, int>, vector<Line>> stars;
for (int i = 0; i < N; ++i) {
for (int j = i + 1; j < N; ++j) {
pair<int, int> intersection;
if (intersects(lines[i], lines[j], intersection)) {
stars[intersection].push_back(lines[i]);
stars[intersection].push_back(lines[j]);
}
}
}
int asiylam = 0;
for (auto& star : stars) {
if (star.second.size() / 2 == K) {
vector<int> intensities;
for (auto& line : star.second) {
intensities.push_back(countCells(line, star.first, true));
}
asiylam += *min_element(intensities.begin(), intensities.end());
}
}
cout << asiylam << endl;
return 0;
}
Magic Star Intensity Code
C++
TCS Exam
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
using namespace std;
struct Line {
int x1, y1, x2, y2;
};
int countCells(Line line, pair<int, int> star, bool split) {
if (line.x1 == line.x2) {
if (split) {
return min(abs(star.second - line.y1), abs(star.second - line.y2)) + 1;
}
else {
return abs(line.y1 - line.y2) + 1;
}
}
else {
if (split) {
return min(abs(star.first - line.x1), abs(star.first - line.x2)) + 1;
}
else {
return abs(line.x1 - line.x2) + 1;
}
}
}
bool intersects(Line a, Line b, pair<int, int>& intersection) {
if (a.x1 == a.x2 && b.y1 == b.y2) {
if (b.x1 <= a.x1 && a.x1 <= b.x2 && a.y1 <= b.y1 && b.y1 <= a.y2) {
intersection = {a.x1, b.y1};
return true;
}
}
if (a.y1 == a.y2 && b.x1 == b.x2) {
if (a.x1 <= b.x1 && b.x1 <= a.x2 && b.y1 <= a.y1 && a.y1 <= b.y2) {
intersection = {b.x1, a.y1};
return true;
}
}
return false;
}
int main() {
int N, K;
cin >> N;
vector<Line> lines(N);
for (int i = 0; i < N; ++i) {
cin >> lines[i].x1 >> lines[i].y1 >> lines[i].x2 >> lines[i].y2;
if (lines[i].x1 > lines[i].x2 || (lines[i].x1 == lines[i].x2 && lines[i].y1 > lines[i].y2)) {
swap(lines[i].x1, lines[i].x2);
swap(lines[i].y1, lines[i].y2);
}
}
cin >> K;
map<pair<int, int>, vector<Line>> stars;
for (int i = 0; i < N; ++i) {
for (int j = i + 1; j < N; ++j) {
pair<int, int> intersection;
if (intersects(lines[i], lines[j], intersection)) {
stars[intersection].push_back(lines[i]);
stars[intersection].push_back(lines[j]);
}
}
}
int asiylam = 0;
for (auto& star : stars) {
if (star.second.size() / 2 == K) {
vector<int> intensities;
for (auto& line : star.second) {
intensities.push_back(countCells(line, star.first, true));
}
asiylam += *min_element(intensities.begin(), intensities.end());
}
}
cout << asiylam << endl;
return 0;
}
Magic Star Intensity Code
C++
TCS Exam
November 29, 2024
November 29, 2024
int main() {
string s;
cin >> s;
int n = s.length(), res = 0;
vector<int> v(n);
for (int i = 0; i < n; ++i) cin >> v[i];
int lw = s[0] - '0', lwv = v[0];
for (int i = 1; i < n; ++i) {
if (s[i] - '0' == lw) {
res += min(lwv, v[i]);
lwv = max(lwv, v[i]);
} else {
lw = s[i] - '0';
lwv = v[i];
}
}
cout << res;
return 0;
}
Form alternating string
Change accordingly before submitting to avoid plagiarism
string s;
cin >> s;
int n = s.length(), res = 0;
vector<int> v(n);
for (int i = 0; i < n; ++i) cin >> v[i];
int lw = s[0] - '0', lwv = v[0];
for (int i = 1; i < n; ++i) {
if (s[i] - '0' == lw) {
res += min(lwv, v[i]);
lwv = max(lwv, v[i]);
} else {
lw = s[i] - '0';
lwv = v[i];
}
}
cout << res;
return 0;
}
Form alternating string
Change accordingly before submitting to avoid plagiarism
November 29, 2024
using System;
using System.Collections.Generic;
class Program
{
static void Main()
{
int N = int.Parse(Console.ReadLine());
var graph = new Dictionary<string, List<string>>();
var indegrees = new Dictionary<string, int>();
for (int i = 0; i < N; i++)
{
var edge = Console.ReadLine().Split();
string from = edge[0];
string to = edge[1];
if (!graph.ContainsKey(from))
graph[from] = new List<string>();
graph[from].Add(to);
if (!indegrees.ContainsKey(from))
indegrees[from] = 0;
if (!indegrees.ContainsKey(to))
indegrees[to] = 0;
indegrees[to]++;
}
var words = Console.ReadLine().Split();
var levels = new Dictionary<string, int>();
var queue = new Queue<string>();
foreach (var node in indegrees.Keys)
{
if (indegrees[node] == 0)
{
levels[node] = 1; // Root level is 1
queue.Enqueue(node);
}
}
while (queue.Count > 0)
{
var current = queue.Dequeue();
int currentLevel = levels[current];
if (graph.ContainsKey(current))
{
foreach (var neighbor in graph[current])
{
if (!levels.ContainsKey(neighbor))
{
levels[neighbor] = currentLevel + 1;
queue.Enqueue(neighbor);
}
indegrees[neighbor]--;
if (indegrees[neighbor] == 0 && !levels.ContainsKey(neighbor))
{
queue.Enqueue(neighbor);
}
}
}
}
int totalValue = 0;
foreach (var word in words)
{
if (levels.ContainsKey(word))
{
totalValue += levels[word];
}
else
{
totalValue += -1;
}
}
Console.Write(totalValue);
}
}
String Puzzle
C+
using System.Collections.Generic;
class Program
{
static void Main()
{
int N = int.Parse(Console.ReadLine());
var graph = new Dictionary<string, List<string>>();
var indegrees = new Dictionary<string, int>();
for (int i = 0; i < N; i++)
{
var edge = Console.ReadLine().Split();
string from = edge[0];
string to = edge[1];
if (!graph.ContainsKey(from))
graph[from] = new List<string>();
graph[from].Add(to);
if (!indegrees.ContainsKey(from))
indegrees[from] = 0;
if (!indegrees.ContainsKey(to))
indegrees[to] = 0;
indegrees[to]++;
}
var words = Console.ReadLine().Split();
var levels = new Dictionary<string, int>();
var queue = new Queue<string>();
foreach (var node in indegrees.Keys)
{
if (indegrees[node] == 0)
{
levels[node] = 1; // Root level is 1
queue.Enqueue(node);
}
}
while (queue.Count > 0)
{
var current = queue.Dequeue();
int currentLevel = levels[current];
if (graph.ContainsKey(current))
{
foreach (var neighbor in graph[current])
{
if (!levels.ContainsKey(neighbor))
{
levels[neighbor] = currentLevel + 1;
queue.Enqueue(neighbor);
}
indegrees[neighbor]--;
if (indegrees[neighbor] == 0 && !levels.ContainsKey(neighbor))
{
queue.Enqueue(neighbor);
}
}
}
}
int totalValue = 0;
foreach (var word in words)
{
if (levels.ContainsKey(word))
{
totalValue += levels[word];
}
else
{
totalValue += -1;
}
}
Console.Write(totalValue);
}
}
String Puzzle
C+
November 29, 2024
Company : NTT
Role : Intern
Qualification :Bachelor’s / Master’s
Batch : 2025 & 2026
Salary : Up to ₹ 6LPA
Experience : Fresher’s
Location : Bengaluru
Apply link : https://careers.services.global.ntt/global/en/job/NTT1GLOBALR121946EXTERNALENGLOBAL/Intern?utm_source=indeed&utm_medium=phenom-feeds
Company : Capgemini
Role : Deal Centre of Excellence
Qualification : Graduate/B Com/BAF
Batch : 2024 without any Active Backlogs
Salary : Up to ₹ 5 LPA
Experience : Fresher’s
Location : Mumbai
Apply link : https://www.capgemini.com/in-en/solutions/off-campus-drive-for-deal-centre-of-excellence-dcoe-2024-graduates/
Role : Intern
Qualification :Bachelor’s / Master’s
Batch : 2025 & 2026
Salary : Up to ₹ 6LPA
Experience : Fresher’s
Location : Bengaluru
Apply link : https://careers.services.global.ntt/global/en/job/NTT1GLOBALR121946EXTERNALENGLOBAL/Intern?utm_source=indeed&utm_medium=phenom-feeds
Company : Capgemini
Role : Deal Centre of Excellence
Qualification : Graduate/B Com/BAF
Batch : 2024 without any Active Backlogs
Salary : Up to ₹ 5 LPA
Experience : Fresher’s
Location : Mumbai
Apply link : https://www.capgemini.com/in-en/solutions/off-campus-drive-for-deal-centre-of-excellence-dcoe-2024-graduates/
November 29, 2024
Count press
#include <iostream>
#include <string>
#include <vector>
#include <unordered_map>
using namespace std;
int dp(string& s, vector<string>& v, unordered_map<string, int>& memo) {
if (memo.count(s)) return memo[s];
int maxRemoval = 0;
for (auto& x : v) {
size_t pos = s.find(x);
if (pos != string::npos) {
string new_string = s.substr(0, pos) + s.substr(pos + x.size());
maxRemoval = max(maxRemoval, 1 + dp(new_string, v, memo));
}
}
return memo[s] = maxRemoval;
}
int main() {
int n;
cin >> n;
vector<string> substrings(n);
for (int i = 0; i < n; ++i) {
cin >> substrings[i];
}
string mainString;
cin >> mainString;
unordered_map<string, int> memo;
cout << dp(mainString, substrings, memo);
return 0;
}
FOLDER AREA
#include <iostream>
#include <cmath>
#include <set>
#include <iomanip>
#include <vector>
#include <utility>
using namespace std;
pair<double, double> reflectPoint(double px, double py, double x1, double y1, double x2, double y2) {
double A = y2 - y1;
double B = x1 - x2;
double C = x2 * y1 - x1 * y2;
double distance = (A * px + B * py + C) / sqrt(A * A + B * B);
double reflectedX = px - 2 * distance * (A / sqrt(A * A + B * B));
double reflectedY = py - 2 * distance * (B / sqrt(A * A + B * B));
return {reflectedX, reflectedY};
}
int main() {
double area;
cout << "Enter area of the square: ";
cin >> area;
double x1, y1, x2, y2;
cout << "Enter the coordinates of the line (x1 y1 x2 y2): ";
cin >> x1 >> y1 >> x2 >> y2;
double side = sqrt(area);
vector<pair<double, double>> corners = {
{0, 0},
{0, side},
{side, side},
{side, 0}
};
set<pair<double, double>> uniquePoints(corners.begin(), corners.end());
for (const auto& corner : corners) {
auto [rx, ry] = reflectPoint(corner.first, corner.second, x1, y1, x2, y2);
uniquePoints.insert({rx, ry});
}
for (const auto& point : uniquePoints) {
cout << fixed << setprecision(2) << point.first << " " << point.second << endl;
}
return 0;
}
Segment display
#include <bits/stdc++.h>
using namespace std;
int main() {
vector<vector<string>> A = {
{"11111", "11111", "11111", "11111", "11111", "11111", "11111", "10001", "11111", "11111", "10001", "10000", "11111", "10001", "01110", "11111", "11111", "11111", "11111", "11111", "10001", "10001", "10001", "10001", "10001", "11111"},
{"10001", "10001", "10000", "10001", "10000", "10000", "10000", "10001", "00100", "00001", "10010", "10000", "10101", "11001", "10001", "10001", "10001", "10001", "10000", "00100", "10001", "10001", "10001", "00000", "10001", "00000"},
{"10001", "10001", "10000", "10001", "10000", "10000", "10000", "10001", "00100", "00001", "10100", "10000", "10101", "10101", "10001", "10001", "10001", "10001", "10000", "00100", "10001", "10001", "10001", "01010", "10001", "00010"},
{"10001", "10001", "10000", "10001", "10000", "10000", "10000", "10001", "00100", "00001", "11000", "10000", "10101", "10011", "10001", "10001", "10001", "10001", "10000", "00100", "10001", "10001", "10001", "00000", "10001", "00000"},
{"11111", "11111", "10000", "10001", "11111", "11111", "10111", "11111", "00100", "10001", "11111", "10000", "10101", "10001", "10001", "11111", "10101", "11111", "11111", "00100", "10001", "10001", "10101", "00100", "11111", "00100"},
{"10001", "10001", "10000", "10001", "10000", "10000", "10001", "10001", "00100", "10001", "10001", "10000", "10001", "10001", "10001", "10000", "10001", "11000", "00001", "00100", "10001", "10001", "10101", "00000", "00001", "00000"},
{"10001", "10001", "10000", "10001", "10000", "10000", "10001", "10001", "00100", "10001", "10001", "10000", "10001", "10001", "10001", "10000", "10011", "10100", "00001", "00100", "10001", "10001", "10101", "01010", "00001", "01000"},
{"10001", "10001", "10000", "10001", "10000", "10000",
#include <iostream>
#include <string>
#include <vector>
#include <unordered_map>
using namespace std;
int dp(string& s, vector<string>& v, unordered_map<string, int>& memo) {
if (memo.count(s)) return memo[s];
int maxRemoval = 0;
for (auto& x : v) {
size_t pos = s.find(x);
if (pos != string::npos) {
string new_string = s.substr(0, pos) + s.substr(pos + x.size());
maxRemoval = max(maxRemoval, 1 + dp(new_string, v, memo));
}
}
return memo[s] = maxRemoval;
}
int main() {
int n;
cin >> n;
vector<string> substrings(n);
for (int i = 0; i < n; ++i) {
cin >> substrings[i];
}
string mainString;
cin >> mainString;
unordered_map<string, int> memo;
cout << dp(mainString, substrings, memo);
return 0;
}
FOLDER AREA
#include <iostream>
#include <cmath>
#include <set>
#include <iomanip>
#include <vector>
#include <utility>
using namespace std;
pair<double, double> reflectPoint(double px, double py, double x1, double y1, double x2, double y2) {
double A = y2 - y1;
double B = x1 - x2;
double C = x2 * y1 - x1 * y2;
double distance = (A * px + B * py + C) / sqrt(A * A + B * B);
double reflectedX = px - 2 * distance * (A / sqrt(A * A + B * B));
double reflectedY = py - 2 * distance * (B / sqrt(A * A + B * B));
return {reflectedX, reflectedY};
}
int main() {
double area;
cout << "Enter area of the square: ";
cin >> area;
double x1, y1, x2, y2;
cout << "Enter the coordinates of the line (x1 y1 x2 y2): ";
cin >> x1 >> y1 >> x2 >> y2;
double side = sqrt(area);
vector<pair<double, double>> corners = {
{0, 0},
{0, side},
{side, side},
{side, 0}
};
set<pair<double, double>> uniquePoints(corners.begin(), corners.end());
for (const auto& corner : corners) {
auto [rx, ry] = reflectPoint(corner.first, corner.second, x1, y1, x2, y2);
uniquePoints.insert({rx, ry});
}
for (const auto& point : uniquePoints) {
cout << fixed << setprecision(2) << point.first << " " << point.second << endl;
}
return 0;
}
Segment display
#include <bits/stdc++.h>
using namespace std;
int main() {
vector<vector<string>> A = {
{"11111", "11111", "11111", "11111", "11111", "11111", "11111", "10001", "11111", "11111", "10001", "10000", "11111", "10001", "01110", "11111", "11111", "11111", "11111", "11111", "10001", "10001", "10001", "10001", "10001", "11111"},
{"10001", "10001", "10000", "10001", "10000", "10000", "10000", "10001", "00100", "00001", "10010", "10000", "10101", "11001", "10001", "10001", "10001", "10001", "10000", "00100", "10001", "10001", "10001", "00000", "10001", "00000"},
{"10001", "10001", "10000", "10001", "10000", "10000", "10000", "10001", "00100", "00001", "10100", "10000", "10101", "10101", "10001", "10001", "10001", "10001", "10000", "00100", "10001", "10001", "10001", "01010", "10001", "00010"},
{"10001", "10001", "10000", "10001", "10000", "10000", "10000", "10001", "00100", "00001", "11000", "10000", "10101", "10011", "10001", "10001", "10001", "10001", "10000", "00100", "10001", "10001", "10001", "00000", "10001", "00000"},
{"11111", "11111", "10000", "10001", "11111", "11111", "10111", "11111", "00100", "10001", "11111", "10000", "10101", "10001", "10001", "11111", "10101", "11111", "11111", "00100", "10001", "10001", "10101", "00100", "11111", "00100"},
{"10001", "10001", "10000", "10001", "10000", "10000", "10001", "10001", "00100", "10001", "10001", "10000", "10001", "10001", "10001", "10000", "10001", "11000", "00001", "00100", "10001", "10001", "10101", "00000", "00001", "00000"},
{"10001", "10001", "10000", "10001", "10000", "10000", "10001", "10001", "00100", "10001", "10001", "10000", "10001", "10001", "10001", "10000", "10011", "10100", "00001", "00100", "10001", "10001", "10101", "01010", "00001", "01000"},
{"10001", "10001", "10000", "10001", "10000", "10000",
November 29, 2024