Skip to main content

Posts

The Divisibility Dilemma Code Techgig Geek Goddess Solution

The Divisibility Dilemma Code Techgig Geek Goddess Solution 100% Working Code uploaded on Youtube: https://youtu.be/6cn7nNtSiKo 100% Working Code uploaded on Telegram: https://telegram.me/PLACEMENTLELO The Divisibility Dilemma (100 Marks) In the picturesque village of Numeropolis, the annual "Divisibility Day" is celebrated with great enthusiasm. This day is marked by various mathematical challenges and games that put the villagers' arithmetic skills to the test. This year, the villagers are embarking on a quest to explore the distinctive properties of subarrays within integer arrays. The village's renowned mathematician, Professor Arithmo, has crafted an intriguing challenge. He has provided the villagers with an integer array nums`and two additional integers, K and P. Professor Arithmo's challenge revolves around discovering and counting distinct subarrays from the array nums. The uniqueness of these subarrays is determined by their divisibility characteristics.

Alex and his Array code TechGig Geek Goddess 2023

 Alex and his Array code TechGig Geek Goddess 2023: 100% Working Code uploaded on Youtube: https://youtu.be/6cn7nNtSiKo 100% Working Code uploaded on Telegram: https://telegram.me/PLACEMENTLELO Alex and his array (100 Marks) Meet Alex, a bright student who is dealing with an array challenge today. He has been given an array a1, a2, ..., aN of length N. The intriguing aspect of this challenge is that Alex can perform various operations on the array elements. In a single operation, Alex is allowed to choose two indices l and r, where 1 ≤ l ≤ r ≤ n. He can then multiply all the elements in the subarray [al, al+1, ..., ar] by -1, effectively reversing their signs. Being pressed for time as he is running late for school, Alex is seeking your assistance in determining the maximum possible sum of numbers in the array. Additionally, he is eager to find out the minimum number of operations required to achieve this maximum sum. Input Format The first line contains an integer N, the length of the

Groundtruth Exam Answers

Groundtruth Exam Solutions  1. A company produces electronic devices with a defect rate of 5%. They implement a new quality control system that reduces the defect rate to 2%. By what percentage did the defect rate decrease 2. A construction project is scheduled to be completed in 40 days with a team of 10 workers. Due to unforeseen circumstances, three workers are unavailable for the project. How many additional days will it take to complete the project with the remaining workers? 3. A rectangular field has a length twice its width. The perimeter of the field is 60 meters. What is the area of the field?  4. A car travels a distance of 240 kilometers with an average speed of 60 km/h. For how many hours did the car travel?  5. A water tank can be filled by two pipes. Pipe A can fill the tank in 6 hours, while Pipe B can fill the tank in 4 hours. How long will it take to fill the tank if both pipes are open simultaneously? 1. Which of the following is an example of a sustainable engineeri

Google Girl Hackathon 3 June 2023 Solutions

Google Girl Hackathon 3 June 2023 Solutions Google Girl Hackathon 2023   Maximize equal numbers Code in Python Task Determine the maximum length of the subsequence of array a, such that all numbers in that subsequence are equal after applying the given operation. Code in Python def MaximizeEqualNumber(n, k, a):     #Telegram - @PLACEMENTLELO     max_length = 0     for i in range(n):     #Telegram - @PLACEMENTLELO         count = 1          for x in range(-k, k+1):     #Telegram - @PLACEMENTLELO             if a[i] + x in a[i+1:]:                 count += 1     #Telegram - @PLACEMENTLELO         max_length = max(max_length, count)     return max_length n = 4 k = 1 a = [2, 5, 1, 2] # Output: 3 n = 4 k = 0 a = [2, 2, 5, 6] # Output: 2 n = 3 k = 2 a = [1,5,6] # Output: 2 That is Perfection Code in Python  def is perfect number (n):      divisors_sum = sum(i for i in range(1, n) if n % i == 0)      return divisors_sum == n Balanced Brackets You are given a string S of length N. It consists

GEEKS FOR GEEKS WEEKLY CODING CONTEST 103 SOLUTIONS

GEEKS FOR GEEKS WEEKLY CODING CONTEST 103 SOLUTIONS Refueling Code Answer C++ Refueling First GFG Weekly Coding Contest 103 class Solution{     public:     long long refueling(int X)     {         long long a, b;         for(int i=0; i<X; i++){             a = pow(2,i);             if(a == X)return a;             else if(a>X){                 b = pow(2,i-1);                 if(abs(X-a) == abs(X-b))return a;                 if(abs(X-a) < abs(X-b))return a;                 else return b;             }         }         return -1;     } }; Input: X = 3,  Output: 4 Input:  X = 2,  Output: 2 K-Periodic Circular String Code Solution  C++ K-Periodic Circular String Second GFG Weekly Coding Contest 103   class Solution{     public:     string kPeriodic(string s, int K){         // code here         map<char,int> hm;         for(int i=0;i<s.size();i++){           hm[s[i]]++;         }         int n= s.size();         int res= n/__gcd(n,K);              for(auto t:hm

Bus Conductor Coding Solution POTD Solution 21 May 2023

Bus Conductor  Coding Solution Geeks for Geeks Problem of the Day 21 May 2023 You are conductor of a bus ...  Return the minimum number of moves required GFG POTD Solution Today   Gfg problem of the day solution with explanation C++ class Solution {   public:     int findMoves(int n, vector<int> chairs, vector<int> passengers) {      sort(chairs.begin(), chairs.end());      sort(passengers.begin(), passengers.end());            int ans=0;      for(int i=0;i<n;i++){          ans=ans+abs(passengers[i]-chairs[i]);      }      return ans;     } }; Input:  chairs = [3,1,5]  passengers = [2,7,4]  Output: 4 Input:  chairs = [2,2,6,6]  passengers = [1,3,2,6]  Output: 4 GFG POTD Answer in C++   Gfg problem of the day in python  Gfg problem of the day in java