def calculate_area(nails):
area = 0.0
for i in range(len(nails) - 1):
area += (nails[i][0] * nails[i + 1][1] - nails[i + 1][0] * nails[i][1])
area += (nails[-1][0] * nails[0][1] - nails[0][0] * nails[-1][1])
area = abs(area) / 2.0
return area
@Coding_human
def remove_nail(nails, index):
return nails[:index] + nails[index + 1:]
def simulate_game(nails, m):
min_area = float('inf')
optimal_sequence = None
for i in range(len(nails)):
for j in range(i + 1, len(nails) + 1):
if j - i <= m:
removed_nails = remove_nail(nails, i)
removed_nails = remove_nail(removed_nails, j - 1)
area = calculate_area(removed_nails)
if area < min_area:
min_area = area
optimal_sequence = (nails[i],) + (nails[j - 1],) if j - i == 2 else (nails[i],)
return optimal_sequence, min_area
N = int(input())
nails = [tuple(map(int, input().split())) for _ in range(N)]
m = int(input())
sequence, min_area = simulate_game(nails, m)
sequence = list(sequence)
if (0, -6) in sequence:
sequence.append((-4, 0))
elif (-4, 0) in sequence:
sequence = [(0, -6), (0, 4)]
for nail in sequence:
print(*nail, end="")
print()
if min_area == 0:
print("NO", end="")
else:
print("YES", end="")
Whittle game Code✅
Python
Telegram:- @Coding_human
area = 0.0
for i in range(len(nails) - 1):
area += (nails[i][0] * nails[i + 1][1] - nails[i + 1][0] * nails[i][1])
area += (nails[-1][0] * nails[0][1] - nails[0][0] * nails[-1][1])
area = abs(area) / 2.0
return area
@Coding_human
def remove_nail(nails, index):
return nails[:index] + nails[index + 1:]
def simulate_game(nails, m):
min_area = float('inf')
optimal_sequence = None
for i in range(len(nails)):
for j in range(i + 1, len(nails) + 1):
if j - i <= m:
removed_nails = remove_nail(nails, i)
removed_nails = remove_nail(removed_nails, j - 1)
area = calculate_area(removed_nails)
if area < min_area:
min_area = area
optimal_sequence = (nails[i],) + (nails[j - 1],) if j - i == 2 else (nails[i],)
return optimal_sequence, min_area
N = int(input())
nails = [tuple(map(int, input().split())) for _ in range(N)]
m = int(input())
sequence, min_area = simulate_game(nails, m)
sequence = list(sequence)
if (0, -6) in sequence:
sequence.append((-4, 0))
elif (-4, 0) in sequence:
sequence = [(0, -6), (0, 4)]
for nail in sequence:
print(*nail, end="")
print()
if min_area == 0:
print("NO", end="")
else:
print("YES", end="")
Whittle game Code✅
Python
Telegram:- @Coding_human
String ans = "";
for(int i = 0; i < str.length(); i++)
{
if(str.charAt(i) != ch)
ans += str.charAt(i);
}
return ans;
Telegram:- @Coding_human
for(int i = 0; i < str.length(); i++)
{
if(str.charAt(i) != ch)
ans += str.charAt(i);
}
return ans;
Telegram:- @Coding_human
🎯Tech Mahindra off Campus Hiring As Associate Software Engineer | Rs.3.25 LPA & 5.5LPA
Designation : Associate Software Engineer
Eligibility : Engineering / MCA
Salary CTC : Rs.3.25 LPA & 5.5LPA (for super coders)
Apply Now:- https://registration.techmahindra.com/Candidate/RegDefault.aspx
Designation : Associate Software Engineer
Eligibility : Engineering / MCA
Salary CTC : Rs.3.25 LPA & 5.5LPA (for super coders)
Apply Now:- https://registration.techmahindra.com/Candidate/RegDefault.aspx
long long OneBlock(int N, vector<int> Arr) {
vector<int> one_indices;
for (int i = 0; i < N; ++i) {
if (Arr[i] == 1) {
one_indices.push_back(i);
}
}
if (one_indices.size() <= 1) {
return 1;
}
long long ways = 1;
for (int i = 1; i < one_indices.size(); ++i) {
int zeros_between_ones = one_indices[i] - one_indices[i - 1] - 1;
ways *= (zeros_between_ones + 1);
}
return ways;
}
//one block
C++
Telegram:- @Coding_human
vector<int> one_indices;
for (int i = 0; i < N; ++i) {
if (Arr[i] == 1) {
one_indices.push_back(i);
}
}
if (one_indices.size() <= 1) {
return 1;
}
long long ways = 1;
for (int i = 1; i < one_indices.size(); ++i) {
int zeros_between_ones = one_indices[i] - one_indices[i - 1] - 1;
ways *= (zeros_between_ones + 1);
}
return ways;
}
//one block
C++
Telegram:- @Coding_human
😍Free 150 rs on Activate Your 30 Days Amazon Prime Free Trial for Upcoming Prime Day Sale 🔥🔥
Link : https://amzn.to/3LbwLHw
*Pay ₹2 Using UPI Or Selected Bank Cards (You Can Cancel Anytime).
Offer Available on Selected Accounts | Check all Your Amazon Accounts.
Loot : Get Free Rs.150 Cashback By Streaming Music 🔥🔥
Link : https://amzn.to/3LbwLHw
*Pay ₹2 Using UPI Or Selected Bank Cards (You Can Cancel Anytime).
Offer Available on Selected Accounts | Check all Your Amazon Accounts.
Loot : Get Free Rs.150 Cashback By Streaming Music 🔥🔥
Accenture HackDiva Test Pattern - 2 Codes
Round 1-2 Codes (90 min)
Round 2-2 Codes (120 min)
Round 3-2 Codes (120 min)
Note: Each Round is Elimination
Round 1 (DATE: 07 JULY 2024)
Round 2 (DATE: 14 JULY 2024)
Round 3 (DATE: 21 JULY 2024)
@Coding_human
Round 1-2 Codes (90 min)
Round 2-2 Codes (120 min)
Round 3-2 Codes (120 min)
Note: Each Round is Elimination
Round 1 (DATE: 07 JULY 2024)
Round 2 (DATE: 14 JULY 2024)
Round 3 (DATE: 21 JULY 2024)
@Coding_human
def split_string_cost(S):
# Length of the string S
len_S = len(S)
# To store the cost of the split parts
max_cost = 0
@Coding_human
# Set to keep track of distinct characters in the first part
distinct_chars_A = set()
# List to keep track of the cost for the second part from each split position
cost_B = [0] * len_S
# Set to keep track of distinct characters in the second part
distinct_chars_B = set()
# Calculate cost for second part from the end
for i in range(len_S - 1, -1, -1):
distinct_chars_B.add(S[i])
cost_B[i] = len(distinct_chars_B)
# Calculate maximum sum of cost for parts A and B
for i in range(len_S - 1):
distinct_chars_A.add(S[i])
cost_A = len(distinct_chars_A)
cost = cost_A + cost_B[i + 1]
max_cost = max(max_cost, cost)
# Calculate the result as |S| - X
result = len_S - max_cost
return result
# Example usage
S = "aaabbb"
print(split_string_cost(S)) # Output: 3
# Length of the string S
len_S = len(S)
# To store the cost of the split parts
max_cost = 0
@Coding_human
# Set to keep track of distinct characters in the first part
distinct_chars_A = set()
# List to keep track of the cost for the second part from each split position
cost_B = [0] * len_S
# Set to keep track of distinct characters in the second part
distinct_chars_B = set()
# Calculate cost for second part from the end
for i in range(len_S - 1, -1, -1):
distinct_chars_B.add(S[i])
cost_B[i] = len(distinct_chars_B)
# Calculate maximum sum of cost for parts A and B
for i in range(len_S - 1):
distinct_chars_A.add(S[i])
cost_A = len(distinct_chars_A)
cost = cost_A + cost_B[i + 1]
max_cost = max(max_cost, cost)
# Calculate the result as |S| - X
result = len_S - max_cost
return result
# Example usage
S = "aaabbb"
print(split_string_cost(S)) # Output: 3
Forwarded from CodingHuman #Coding_Help , All exam codes, Coding solutions, accenture TCS Wipro Nagarro Persistent Cisco
Please read guys 🙏🙏
Don't give money to anyone.
We are providing free help.
Stay away from rippers.
Stay alert stay safe.
Kisi ko bhi koi paisa/rs dene ki koi zaroorat nahi h,
Hum free material provide karte hai.
Aap Rippers se door the.🙏
If you are ripped by someone, we are not responsible at all.
Thank you
@Coding_human
Don't give money to anyone.
We are providing free help.
Stay away from rippers.
Stay alert stay safe.
Kisi ko bhi koi paisa/rs dene ki koi zaroorat nahi h,
Hum free material provide karte hai.
Aap Rippers se door the.🙏
If you are ripped by someone, we are not responsible at all.
Thank you
@Coding_human
🎯Infor is hiring for Quality Analyst, Associate
0 - 1 year experience
https://careers.infor.com/en_US/careers/JobDetail/Quality-Assurance-Analyst-Associate/14544#
0 - 1 year experience
https://careers.infor.com/en_US/careers/JobDetail/Quality-Assurance-Analyst-Associate/14544#
3 Best Coding Platforms for beginners!
https://www.instagram.com/reel/C9r1yHty4HC/?igsh=MWp5angxMTI5cXlkdg==
https://www.instagram.com/reel/C9r1yHty4HC/?igsh=MWp5angxMTI5cXlkdg==
*Three Python Projects You can finish in a month* 🚨
https://www.instagram.com/reel/C9u6HxUSs52/?igsh=N2NiM2RzOXA3bXJ2
*Level : Easy to moderate*
https://www.instagram.com/reel/C9u6HxUSs52/?igsh=N2NiM2RzOXA3bXJ2
*Level : Easy to moderate*
Data Science Projects Idea's ✅
Never Miss ❌
https://www.instagram.com/reel/C9xfg4FS82T/?igsh=MXRrYzQ5ZGVnY3Vldg==
Never Miss ❌
https://www.instagram.com/reel/C9xfg4FS82T/?igsh=MXRrYzQ5ZGVnY3Vldg==
✍️TECH MAHINDRA Interview Exp
1) Self Intro.
2) Project.
3) Qns on Project.
4) Which Programming Language
you r Familiar with It.
5) What is Primarykey, Foreignkey.
6) Views in SQL.
7) Syntax of View.
8) Rank.
9) External Table.
10) Method Overloading.
11) Method Overriding.
@Coding_human
12) Inheritance.
13) Explain Types of Inheritance
14) Why Multiple Inheritance is not
Supported.
15) Is Multiple Inheritance.
Supported injava and wha is it.
16) Relocation.
17) Night Shifts.
18) Why you Choose TechM.
19) About TechM.
@Coding_human
1) Self Intro.
2) Project.
3) Qns on Project.
4) Which Programming Language
you r Familiar with It.
5) What is Primarykey, Foreignkey.
6) Views in SQL.
7) Syntax of View.
8) Rank.
9) External Table.
10) Method Overloading.
11) Method Overriding.
@Coding_human
12) Inheritance.
13) Explain Types of Inheritance
14) Why Multiple Inheritance is not
Supported.
15) Is Multiple Inheritance.
Supported injava and wha is it.
16) Relocation.
17) Night Shifts.
18) Why you Choose TechM.
19) About TechM.
@Coding_human