WhiteHat Coding
رفتن به کانال در Telegram
650
مشترکین
اطلاعاتی وجود ندارد24 ساعت
-27 روز
-330 روز
آرشیو پست ها
Guy's,
Do you want TATA STEEL
Answers For Free
Should we post all answers for free in this group??
If you want free answers
Hit Like 👍 Button
share @Coding_000❤️
Charles and neclacr code in c++
using System;
public class UserMainCode
{
public int find_Sol(int input1, int input2, int input3)
{
int count = 0;
for (int n = 1; n <= input1; n++)
{
int[] a = new int[n];
a[0] = input2;
count += CountNecklaces(a, input3);
}
return count;
}
private int CountNecklaces(int[] a, int max)
{
int count = 1;
int k = a.Length;
if (k == a.Length)
{
for (int i = 0; i < k; i++)
{
if (a[i] < 1 || a[i] > max) return 0;
if (i > 0 && a[i] < a[i - 1]) return 0;
}
return 1;
}
else
{
for (int i = 1; i <= max; i++)
{
int[] b = new int[k];
Array.Copy(a, b, k);
b[k] = i;
count += CountNecklaces(b, max);
}
return count;
}
}
}
#include <iostream>
#include <string>
#include <unordered_set>
using namespace std;
int countDistinctYears(string document) {
unordered_set<int> years; // Use a set to store distinct years
int pos = 0;
while (pos < document.size()) {
if (isdigit(document[pos])) { // If current character is a digit
int year = stoi(document.substr(pos + 6, 4)); // Extract the year from the string
years.insert(year); // Add the year to the set
pos += 11; // Move to the next event
} else {
pos++; // Move to the next character
}
}
return years.size(); // Return the number of distinct years
}
Social network code
// ZOMBIES CODE IN TATA STEEL
#include <iostream>
using namespace std;
int gcd(int a, int b) {
// Euclid's algorithm to find greatest common divisor
while (b != 0) {
int t = b;
b = a % b;
a = t;
}
return a;
}
bool is_magical(int city1, int city2) {
// check if two cities are magical
return gcd(city1, city2) == 1;
}
bool is_good(int city1, int city2) {
// check if city1 is good
return city1 > city2;
}
int find_perfect_city(int zombies[], int n) {
for (int i = 0; i < n - 1; i++) {
if (is_magical(zombies[i], zombies[i + 1]) && is_good(zombies[i], zombies[i + 1])) {
return i;
}
}
// if no perfect city is found, return -1
return -1;
}
int main() {
// Example usage:
int zombies[] = { 4, 1, 3, 2 };
int n = sizeof(zombies) / sizeof(zombies[0]);
int index = find_perfect_city(zombies, n);
if (index != -1) {
cout << "The leftmost perfect city is: " << index << endl;
}
else {
cout << "No perfect city found" << endl;
}
return 0;
}
int result=0;
Arrays.sort(input3);
int i=0;
int k=input3.length-1;
while(input2>0) {
result=result+input3[k];
i++;
k--;
input2--;
}
return result;
Coding marathon
Java8
Guy's,
Do you want TATA STEEL
Answers For Free
Should we post all answers for free in this group??
If you want free answers
Hit Like 👍 Button
share @whitehatcoding
Tata steel Slot 1👇👇
https://t.me/exams_discussion
https://t.me/exams_discussion
Tata Steel Slot 2 👇👇
https://t.me/tatasteelcoding
https://t.me/tatasteelcoding
Any one want projects -mini or Major 😊 Unique project💥💥
Domain AI/ML
contact -@ILOVEU_143 ❤️
Anyone need help in GRE and TOFEL, GMAT, DUOLINGO Exam help 👨💻👨💻
SOP , LOR✍📝
Note -paid 🤑
share✅ share ✅@Coding_000
Tata steel Pattern
share @Coding_000✅
