SlideShare a Scribd company logo
Google Developer Student Clubs
CET-B
WEEK-1
EDITORIAL
CET-B
DAY-1
Problem Statement: In a certain game, a player's score is
decided by the formula a+b*c/a-b , where a, b and c denote
his score on levels 1 2 and 3. Given input as a, b and c, you have
to find the resulting score of the player.
Approach: Taking the all numbers input first you can just
calculate just by giving the expression in the code.
The system will automatically solve the expression and give the
output.
CET-B
DAY-2
Problem Statement: You are going to appear a fast-aptitude
exam, but only people with a calculating mind can clear it.
Given 2 years, write a program to calculate the total number of
days in both years.
Approach: Basically, you need to calculate whether the year is
leap year or not. If leap year the year will have 366 days else
365 days.
A number is a leap year if it is divisible by 4 and not divisible by
100 or its divisible by 400.
CET-B
DAY-3
Problem Statement: Given that your semester results are out
and you have received the credits of each subject. Frame a pro-
gram to input your credit of each subject in a line in form of a
string separated by commas.
Approach: After taking the input string, write a condition in
which the iterator goes to the new line if there is a comma (,)
else it will print the characters.
CET-B
DAY-4
Problem Statement: Zumba sports club has the following grading
policy: -
- Every player receives a point in the inclusive range from 0 to 100.
- If a player scores a point less than 35, he is disqualified
Joy is a coach at the sports club who likes to round each student's
point according to these rules: -
- If the difference between the point and the next multiple of 5 is less
than 3, round point up to the next multiple of 5.
- If the value of point is less than equal to 33, no rounding occurs as the
result will still be a disqualifying score.
Approach: First check that the number is less than or equal to 33 or not.
If condition satisfies no rounding occurs.
For finding the nearest multiple of 5 we can take a loop starting from i=1
and it will be added with the input number. Then you can check after
adding that the resulting number is divisible by 5 or not and if divisible
it’s the nearest multiple of 5. Then we can check by calculating the
difference between multiple of 5 and input number and if less than 3
then round off else not.
You can also find the modulus of the number with 5 and use the remain-
der value to find the net multiple of 5
CET-B
DAY-5
Problem Statement: Given an array of n integers. Find the
unique elements in the array and print them.
Unique elements are the elements which occur only once in
the array.
Approach: After taking the input string, take a nested loop
along with a counter variable. First array will check each
element and the other element will iterate through the total
array and check its second occurrence. If it occurs once more
then the counter variable increases.
If the counter variable equals to 1 then the element will be
printed.
Google Developer Student Clubs
CET-B
WEEK-2
EDITORIAL
CET-B
DAY-7
Problem Statement: Himansh loves billiards very much. One
day while playing a match , he found out a new trick in the
game. He interpreted each red balls as 0 and each white balls
as 1 .He started taking a note of the positions of white and red
balls in the table. If there are at least 6 balls of same color
placed one after another, then the situation is considered dan-
gerous else its out of danger.
Approach: After taking the input string, with the help of pre-
defined function taking a string containing six 0's and six 1's
compare and search if that string is found inside the main
input string .
If it is found then print "DANGEROUS" else "NOT DANGEROUS".
CET-B
DAY-8
Problem Statement: While checking the English papers of the
board exams ,the professor often gets frustated by the writing
format of words of the student in the examination paper. The words
were a net mix of upper case and the lower case letters in every
words. An idea struck into the mind of the professor to develop an
extension that would change the letters' register in every word so
that it either only consisted of lower case letters or, vice cersa, only
of uppercase ones. At that as little as possible letters should be
changed in the word. For example, the word HoUse must be
replaced with house, and the word ViP — with VIP.
Approach: After taking the input check how many upper case and
lower case letters are present by using a count variable.
If more number of lower case are present then convert the whole
string to lowercase else convert it to uppercase.
CET-B
DAY-9
Problem Statement: There are n students standing in a row for a
drill. They are given Red(R), Blue(B) and Green(G) colored tshirts.
The instructor wanted to remove some students from the row
such that two neighboring students don't have the same color
tshirts. Students in a row are considered neighboring if there are
no other students between them.
Approach: Create a loop which take iteration for every charac-
ter in an input string and check whether the character is equal to
it's adjescent character.
If it is so then increase the value of variable by one which was
initially declared as zero. Finally print the value of variable after
the loop over. Repeat the process for number of test cases.
CET-B
DAY-10
Problem Statement: A primary school teacher has taught the
students english alphabets. He now wants to test the
students. He has given his n students a task to write sentenc-
es with every alphabet occuring atleast once. He has taught
the students only lowercase alphabets. Given a string without
spaces findif every alphabet of english language has occured
atleast once. If the student has passed the test the teacher
gave them a pass mark.The sentences need not be meaning-
ful.
Approach: Create an integer array of size 26 where each place
represent the ascii character of each lower case alphabet.
Then just increment the values
in the appropriate places when that character appear in the
sentence. Loop through the characters of the string and sub-
tract the ascii from 97
to get values ranging from 1-26 then increment the value in
the array. Then check if any position is having value 0 then
print fail else pass.
CET-B
DAY-11
Problem Statement: There are n marbles in a row. A child has
to divide the marbles in halves untill he gets one marble. Find
the minimum number of steps required to get the single
marble. The halves can be unequal for odd numbers. After a
division from odd even pair the child has to choose the even
pair for futher division if the odd number is not 1.
Approach: First you need to enter the number of marbles in a
row. Then keep on dividing the number of marbles till there is
only one marble left. Count the minimum number of steps
required to get a single marble. If the number gets divided to
and even and odd number, continue the division with the even
one.
CET-B
DAY-12
Problem Statement: Given a square matrix, calculate the absolute
difference between the sums of its opposite rows and opposite
columns.
For example, the square matrix arr is shown below:
1 2 3
7 5 6
9 8 9
The sum of the rows = 1+2+3+9+8+9= 32. The sum of the columns =
1+7+9+3+6+9= 35. Their absolute difference is |32-35|=3.
Approach: ake the matrix as input.Then add all the elements of first row
with that of the last row and store in a variable. Add all the elements of
first
column with that of the last column and store in another variable. Print
the absolute difference between them.
CET-B
DAY-14
Problem Statement: There are n students in a class. They are given
numbers according to their height, like if two students have same
heights they are given same number. They are arranged in a pyra-
mid manner.
A pyramid manner is basically a sequence of numbers, with initially
an increasing order, then the peak, then a decreasing order, look-
ing like a pyramid.
Now, the class teacher needs to find the place where the tallest
student is standing.
Approach: Initially create two variable, the first variable store the
starting index and second variable store the ending index of input
array.
Then create a continuous loop which ends when both the variable
have same value. In each iteration find the middle index and com-
pare the
value at that position with upper value, if it is greater then second
variable should store the middle index else first variable should
store the upper middle index. Repeat this until the loop over. After
the loop over print the upper index of first variable.
Google Developer Student Clubs
CET-B
WEEK-3
EDITORIAL
CET-B
DAY-15
Problem Statement: There are n students appearing an online
exam. Each of them are given serial numbers starting from 1 to
n. No two students can have the same serial number. Each of
the students are asked to write their serial numbers on the top.
One of the student copied all the answers from another
student. He forgot to change his serial number and submitted
his answer sheet with the other students serial number. Find
the student who cheated. The teacher has recieved the
answer sheets in a random manner. If no students has cheated
print 0.
Approach: Create a continuous loop which occurs for t times,
t is the number of test cases. In each iteration take inupt array
and store in a variable.
Then create two loop to check which number is missing in the
range from 1 to n. finally print the missing number.
CET-B
DAY-16
Problem Statement: Mirsha is a computer science student in her
final year. During a certain event, she was faced with an interesting
problem.
Given a list of numbers, all except one numbers follows a certain
odd-even pattern. Basically this means, from the list, 1 number will
be odd, and rest even, or vice versa. Your task is to find the index of
the number which doesn't follow the pattern.
The indexing here starts from 1.
Approach: Initialize two variable k1 and k2 with integer value zero.
Then for each number in the array check if it is even or odd, for
even number
increase the value of k1 by and for odd number do same with k2.
Finally if k1 is greater then k2, then find the index of odd number
and print it
else find the index of even number and print it. Repeat the process
for all test cases.
CET-B
DAY-17
Problem Statement: A company decided to start a lucky draw for its
customers. The company gave its customers a lucky draw coupon with a
serial number printed on it.
The serial number ranges from 1 to n. The company devised a rule to
decide the lucky numbers:-
-Starting with the serial number, replace the serial number by the sum of
the squares of its digits.
-Repeat the process until the number equals 1 (where it will stay), or it
loops endlessly in a cycle which does not include 1.
-Those numbers for which this process ends in 1 are lucky.
The customers are asked to submit their tickets at the counter and their
serial numbers are checked their and lucky or unlucky is printed over their
tickets based on their serial number.
Approach: After taking the input first check if the number is greater than
9 or not. If smaller than 9 then its unlucky. Then calculate the sum of each
digits in the number and if it results to something other than 1 then the
number will be the sum and like this it checks in a loop.
CET-B
DAY-18
Problem Statement: A number of balls are kept in a basket each
named in the range [1,n]. some students picked few balls randomly
and changed their numbers to existing numbers in the box and
then added back. Now box has unique numbers + duplicate num-
bers. Find the original numbers on the balls whose numbers were
changed.
Approach: First input the number of test cases.
Input size of array(arr[]) and then input the array elements.
Then another array(reg[]) has been created to check which all
elements are present in the array from 1-n. The value of this array
will contain eiher 1 or 0 depicting which elements are present(val-
ue=1) and which are absent(value=0).
Once it's done, Then we once again traverse this reg[] array and
print the index value where the value is 0(depicting absent).
CET-B
DAY-19
Problem Statement: Given a number of balls placed on top of each other in
an order. It is kept in such a way that the number of balls goes on increasing in
a column and then decreasing which resembles a mountain pattern.Jonita has
been asked by her teacher to find whether the mountain has steep slope or
gentle slope. Help Jonita solving out this problem.
Approach: In this problem four loop is required. Using first loop store the
largest value from array in a variable. In the second loop find the index for
lagest value from the array and name it middle_index.
then divide the array into two part from middle_index. In the 3rd loop check if
any number repeat in first part of array and if so then print "gentle" and break
the loop, if not go to 4th loop.
In 4th loop check if any number repeat in second part of array if so print
"gentle" and break the loop, if not then just out from the loop and print
"steep".
CET-B
DAY-20
Problem Statement: Tony has been assigned a number n and
was asked to represent it as a sum of maximum possible
number of prime numbers.One can prove that such represen-
tation exists for any integer greater than 1. Help Tony to solve
this problem.
Approach: First check the number n is even or odd. For even
number print "n/2" then print "2" for n/2 times and for odd
number print interger value
of n/2 then print (n-3)/2 times "2" and one times "3". Repeat
this process for all test cases.
CET-B
DAY-21
Problem Statement: A baker wants to raise some yeast in a container for making bread.
Initially, the container is empty. Each morning, the baker can put any number of yeast into the
container. And each night, every yeast cell in the container will split into two yeast cells. You
hope to see exactly x yeast cells in the container at some moment.
What is the minimum number of yeast cells the baker needs to put into the container across
those days?
Approach: Initialize an integer variable k with zero. Check if the input integer is odd number
then increase k by one and the new value of n should be
(n-1)/2 , if number is even then just change n to n/2. All these process should be under an
continuous loop whose boolean value always be True,
if n reach to one then break the loop by incresing k by one. Finally print the value of k. Repeat
the process for all test cases.
Or,
FUNCTION TO SOLVE FOR N
Basically we need to form n(given number) as a sum of powers of 2
for example take 15
15 = (2^3) + (2^2) + (2^1) + (2^0)
and as it is clear there is no better way than expressing the number in binary
15 = 1111
to express 15 we need 4 powers of 2 (therefore 4 1's in the binary form of 15)
hence the answer to n is the number of 1's in the binary form of n
verify this on 5
5 = 0101 thus the answer is 2
Set a counter 'ctr' for counting no. of 1's
In the end:
for (int m = n;m>0; m/=2)
{
ctr += m%2;
}
return ctr;

More Related Content

What's hot

Solve ratio problems
Solve ratio problemsSolve ratio problems
Solve ratio problems
Amna Abunamous
 
Lesson2
Lesson2 Lesson2
Unit 8 Fourth Grade 2012 2013
Unit 8 Fourth Grade 2012 2013Unit 8 Fourth Grade 2012 2013
Unit 8 Fourth Grade 2012 2013
Isaac_Schools_5
 
Samples
SamplesSamples
Lesson plan in mathematics 8 (Factoring Perfect Square Trinomial)
Lesson plan in mathematics 8 (Factoring Perfect Square Trinomial) Lesson plan in mathematics 8 (Factoring Perfect Square Trinomial)
Lesson plan in mathematics 8 (Factoring Perfect Square Trinomial)
Rachel Ann
 
Number concept kenji yeoh 821
Number concept kenji yeoh 821Number concept kenji yeoh 821
Number concept kenji yeoh 821
Kenjiyoyo
 
Algebraic Expressions and Equations
Algebraic Expressions and EquationsAlgebraic Expressions and Equations
Algebraic Expressions and Equations
Sonarin Cruz
 
P7.4
P7.4P7.4
P7.4
susan70
 
Authentic learning activity
Authentic learning activityAuthentic learning activity
Authentic learning activity
obakeng mokotedi
 
Translations of real-verbal expressions into letters or symbols and vice versa.
Translations of real-verbal expressions into letters or symbols and vice versa.Translations of real-verbal expressions into letters or symbols and vice versa.
Translations of real-verbal expressions into letters or symbols and vice versa.
April Rose Anin
 
Unit 5 Fourth Grade 2012 2013
Unit 5 Fourth Grade 2012 2013Unit 5 Fourth Grade 2012 2013
Unit 5 Fourth Grade 2012 2013
Isaac_Schools_5
 
Fractions webinar
Fractions webinarFractions webinar
Fractions webinar
steveb10
 
Programed instructional material: Rational Numbers
Programed instructional material: Rational NumbersProgramed instructional material: Rational Numbers
Programed instructional material: Rational Numbers
Atul Thakur
 
Unit 6 presentation base ten equality form of a number with trainer notes 7.9.08
Unit 6 presentation base ten equality form of a number with trainer notes 7.9.08Unit 6 presentation base ten equality form of a number with trainer notes 7.9.08
Unit 6 presentation base ten equality form of a number with trainer notes 7.9.08
jcsmathfoundations
 
Differentiates expression from equation, Translate word phrase to numerical e...
Differentiates expression from equation, Translate word phrase to numerical e...Differentiates expression from equation, Translate word phrase to numerical e...
Differentiates expression from equation, Translate word phrase to numerical e...
April Rose Anin
 
Common Core Trajectory
Common Core TrajectoryCommon Core Trajectory
Common Core Trajectory
stepheniemichelle
 
Saxman Hypermedia
Saxman HypermediaSaxman Hypermedia
Saxman Hypermedia
sdsaxman
 
Solving Equations by Factoring KTIP lesson plan
Solving Equations by Factoring KTIP lesson planSolving Equations by Factoring KTIP lesson plan
Solving Equations by Factoring KTIP lesson plan
Josephine Neff
 
Crespo UBD Complex Numbers
Crespo UBD Complex NumbersCrespo UBD Complex Numbers
Crespo UBD Complex Numbers
Irma Crespo
 
Introduction
IntroductionIntroduction
Introduction
Awais Khan
 

What's hot (20)

Solve ratio problems
Solve ratio problemsSolve ratio problems
Solve ratio problems
 
Lesson2
Lesson2 Lesson2
Lesson2
 
Unit 8 Fourth Grade 2012 2013
Unit 8 Fourth Grade 2012 2013Unit 8 Fourth Grade 2012 2013
Unit 8 Fourth Grade 2012 2013
 
Samples
SamplesSamples
Samples
 
Lesson plan in mathematics 8 (Factoring Perfect Square Trinomial)
Lesson plan in mathematics 8 (Factoring Perfect Square Trinomial) Lesson plan in mathematics 8 (Factoring Perfect Square Trinomial)
Lesson plan in mathematics 8 (Factoring Perfect Square Trinomial)
 
Number concept kenji yeoh 821
Number concept kenji yeoh 821Number concept kenji yeoh 821
Number concept kenji yeoh 821
 
Algebraic Expressions and Equations
Algebraic Expressions and EquationsAlgebraic Expressions and Equations
Algebraic Expressions and Equations
 
P7.4
P7.4P7.4
P7.4
 
Authentic learning activity
Authentic learning activityAuthentic learning activity
Authentic learning activity
 
Translations of real-verbal expressions into letters or symbols and vice versa.
Translations of real-verbal expressions into letters or symbols and vice versa.Translations of real-verbal expressions into letters or symbols and vice versa.
Translations of real-verbal expressions into letters or symbols and vice versa.
 
Unit 5 Fourth Grade 2012 2013
Unit 5 Fourth Grade 2012 2013Unit 5 Fourth Grade 2012 2013
Unit 5 Fourth Grade 2012 2013
 
Fractions webinar
Fractions webinarFractions webinar
Fractions webinar
 
Programed instructional material: Rational Numbers
Programed instructional material: Rational NumbersProgramed instructional material: Rational Numbers
Programed instructional material: Rational Numbers
 
Unit 6 presentation base ten equality form of a number with trainer notes 7.9.08
Unit 6 presentation base ten equality form of a number with trainer notes 7.9.08Unit 6 presentation base ten equality form of a number with trainer notes 7.9.08
Unit 6 presentation base ten equality form of a number with trainer notes 7.9.08
 
Differentiates expression from equation, Translate word phrase to numerical e...
Differentiates expression from equation, Translate word phrase to numerical e...Differentiates expression from equation, Translate word phrase to numerical e...
Differentiates expression from equation, Translate word phrase to numerical e...
 
Common Core Trajectory
Common Core TrajectoryCommon Core Trajectory
Common Core Trajectory
 
Saxman Hypermedia
Saxman HypermediaSaxman Hypermedia
Saxman Hypermedia
 
Solving Equations by Factoring KTIP lesson plan
Solving Equations by Factoring KTIP lesson planSolving Equations by Factoring KTIP lesson plan
Solving Equations by Factoring KTIP lesson plan
 
Crespo UBD Complex Numbers
Crespo UBD Complex NumbersCrespo UBD Complex Numbers
Crespo UBD Complex Numbers
 
Introduction
IntroductionIntroduction
Introduction
 

Similar to Septocode 2021 editorial

G6 m2-d-lesson 16-t
G6 m2-d-lesson 16-tG6 m2-d-lesson 16-t
G6 m2-d-lesson 16-t
mlabuski
 
MATH7 ADM MODULE 3.pdf
MATH7 ADM MODULE 3.pdfMATH7 ADM MODULE 3.pdf
MATH7 ADM MODULE 3.pdf
NelsonNelson56
 
Math 116 pres. 3
Math 116 pres. 3Math 116 pres. 3
STI Course A Closer Look at Singapore Math by Yeap Ban Har
STI Course A Closer Look at Singapore Math by Yeap Ban HarSTI Course A Closer Look at Singapore Math by Yeap Ban Har
STI Course A Closer Look at Singapore Math by Yeap Ban Har
Jimmy Keng
 
WEEK 4.doc
WEEK 4.docWEEK 4.doc
WEEK 4.doc
Christiannebre
 
(7) Lesson 3.2 - Add Integers
(7) Lesson 3.2 - Add Integers(7) Lesson 3.2 - Add Integers
(7) Lesson 3.2 - Add Integers
wzuri
 
Probability module 1
Probability module 1Probability module 1
Probability module 1
Richard Paulino
 
counting techniques
counting techniquescounting techniques
counting techniques
Unsa Shakir
 
2 Day Training Day 1
2 Day Training Day 12 Day Training Day 1
2 Day Training Day 1
Janet Bryson
 
Tech math 2 day 1 review
Tech math 2   day 1 reviewTech math 2   day 1 review
Tech math 2 day 1 review
pdkiser
 
Solving inequalities
Solving inequalitiesSolving inequalities
Solving inequalities
Ita Rodriguez
 
A Problem Solving Approach To Mathematics For Elementary School Teachers
A Problem Solving Approach To Mathematics For Elementary School TeachersA Problem Solving Approach To Mathematics For Elementary School Teachers
A Problem Solving Approach To Mathematics For Elementary School Teachers
Kimberly Pulley
 
Computational skills
Computational skillsComputational skills
Computational skills
leoscotch
 
Exercises for pupils in primary education(0 4)-en
Exercises for pupils in primary education(0 4)-enExercises for pupils in primary education(0 4)-en
Exercises for pupils in primary education(0 4)-en
Georgeta Manafu
 
Math Lit Lessons 2.5 & 2.6
Math Lit Lessons 2.5 & 2.6Math Lit Lessons 2.5 & 2.6
Math Lit Lessons 2.5 & 2.6
kathleenalmy
 
Exit ticket lessons 1 13 sample solutions
Exit ticket lessons 1 13 sample solutionsExit ticket lessons 1 13 sample solutions
Exit ticket lessons 1 13 sample solutions
mlabuski
 
Class Presentation Math 1
Class Presentation Math 1Class Presentation Math 1
Class Presentation Math 1
Michelle Podulka
 
NTS-Book-for-GAT-General
NTS-Book-for-GAT-GeneralNTS-Book-for-GAT-General
NTS-Book-for-GAT-General
Ammad khan
 
Nts and gat general book
Nts and gat general bookNts and gat general book
Nts and gat general book
Yasar Hayat
 
Bilangan bulat
Bilangan bulatBilangan bulat
Bilangan bulat
EvaRini1
 

Similar to Septocode 2021 editorial (20)

G6 m2-d-lesson 16-t
G6 m2-d-lesson 16-tG6 m2-d-lesson 16-t
G6 m2-d-lesson 16-t
 
MATH7 ADM MODULE 3.pdf
MATH7 ADM MODULE 3.pdfMATH7 ADM MODULE 3.pdf
MATH7 ADM MODULE 3.pdf
 
Math 116 pres. 3
Math 116 pres. 3Math 116 pres. 3
Math 116 pres. 3
 
STI Course A Closer Look at Singapore Math by Yeap Ban Har
STI Course A Closer Look at Singapore Math by Yeap Ban HarSTI Course A Closer Look at Singapore Math by Yeap Ban Har
STI Course A Closer Look at Singapore Math by Yeap Ban Har
 
WEEK 4.doc
WEEK 4.docWEEK 4.doc
WEEK 4.doc
 
(7) Lesson 3.2 - Add Integers
(7) Lesson 3.2 - Add Integers(7) Lesson 3.2 - Add Integers
(7) Lesson 3.2 - Add Integers
 
Probability module 1
Probability module 1Probability module 1
Probability module 1
 
counting techniques
counting techniquescounting techniques
counting techniques
 
2 Day Training Day 1
2 Day Training Day 12 Day Training Day 1
2 Day Training Day 1
 
Tech math 2 day 1 review
Tech math 2   day 1 reviewTech math 2   day 1 review
Tech math 2 day 1 review
 
Solving inequalities
Solving inequalitiesSolving inequalities
Solving inequalities
 
A Problem Solving Approach To Mathematics For Elementary School Teachers
A Problem Solving Approach To Mathematics For Elementary School TeachersA Problem Solving Approach To Mathematics For Elementary School Teachers
A Problem Solving Approach To Mathematics For Elementary School Teachers
 
Computational skills
Computational skillsComputational skills
Computational skills
 
Exercises for pupils in primary education(0 4)-en
Exercises for pupils in primary education(0 4)-enExercises for pupils in primary education(0 4)-en
Exercises for pupils in primary education(0 4)-en
 
Math Lit Lessons 2.5 & 2.6
Math Lit Lessons 2.5 & 2.6Math Lit Lessons 2.5 & 2.6
Math Lit Lessons 2.5 & 2.6
 
Exit ticket lessons 1 13 sample solutions
Exit ticket lessons 1 13 sample solutionsExit ticket lessons 1 13 sample solutions
Exit ticket lessons 1 13 sample solutions
 
Class Presentation Math 1
Class Presentation Math 1Class Presentation Math 1
Class Presentation Math 1
 
NTS-Book-for-GAT-General
NTS-Book-for-GAT-GeneralNTS-Book-for-GAT-General
NTS-Book-for-GAT-General
 
Nts and gat general book
Nts and gat general bookNts and gat general book
Nts and gat general book
 
Bilangan bulat
Bilangan bulatBilangan bulat
Bilangan bulat
 

Recently uploaded

The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
heathfieldcps1
 
Smart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICTSmart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICT
simonomuemu
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
National Information Standards Organization (NISO)
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
Celine George
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
TechSoup
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
Israel Genealogy Research Association
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
IreneSebastianRueco1
 
Cognitive Development Adolescence Psychology
Cognitive Development Adolescence PsychologyCognitive Development Adolescence Psychology
Cognitive Development Adolescence Psychology
paigestewart1632
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
Katrina Pritchard
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
tarandeep35
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
chanes7
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
Colégio Santa Teresinha
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
adhitya5119
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
Celine George
 

Recently uploaded (20)

The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
 
Smart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICTSmart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICT
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
 
Cognitive Development Adolescence Psychology
Cognitive Development Adolescence PsychologyCognitive Development Adolescence Psychology
Cognitive Development Adolescence Psychology
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
 

Septocode 2021 editorial

  • 1. Google Developer Student Clubs CET-B WEEK-1 EDITORIAL
  • 2. CET-B DAY-1 Problem Statement: In a certain game, a player's score is decided by the formula a+b*c/a-b , where a, b and c denote his score on levels 1 2 and 3. Given input as a, b and c, you have to find the resulting score of the player. Approach: Taking the all numbers input first you can just calculate just by giving the expression in the code. The system will automatically solve the expression and give the output.
  • 3. CET-B DAY-2 Problem Statement: You are going to appear a fast-aptitude exam, but only people with a calculating mind can clear it. Given 2 years, write a program to calculate the total number of days in both years. Approach: Basically, you need to calculate whether the year is leap year or not. If leap year the year will have 366 days else 365 days. A number is a leap year if it is divisible by 4 and not divisible by 100 or its divisible by 400.
  • 4. CET-B DAY-3 Problem Statement: Given that your semester results are out and you have received the credits of each subject. Frame a pro- gram to input your credit of each subject in a line in form of a string separated by commas. Approach: After taking the input string, write a condition in which the iterator goes to the new line if there is a comma (,) else it will print the characters.
  • 5. CET-B DAY-4 Problem Statement: Zumba sports club has the following grading policy: - - Every player receives a point in the inclusive range from 0 to 100. - If a player scores a point less than 35, he is disqualified Joy is a coach at the sports club who likes to round each student's point according to these rules: - - If the difference between the point and the next multiple of 5 is less than 3, round point up to the next multiple of 5. - If the value of point is less than equal to 33, no rounding occurs as the result will still be a disqualifying score. Approach: First check that the number is less than or equal to 33 or not. If condition satisfies no rounding occurs. For finding the nearest multiple of 5 we can take a loop starting from i=1 and it will be added with the input number. Then you can check after adding that the resulting number is divisible by 5 or not and if divisible it’s the nearest multiple of 5. Then we can check by calculating the difference between multiple of 5 and input number and if less than 3 then round off else not. You can also find the modulus of the number with 5 and use the remain- der value to find the net multiple of 5
  • 6. CET-B DAY-5 Problem Statement: Given an array of n integers. Find the unique elements in the array and print them. Unique elements are the elements which occur only once in the array. Approach: After taking the input string, take a nested loop along with a counter variable. First array will check each element and the other element will iterate through the total array and check its second occurrence. If it occurs once more then the counter variable increases. If the counter variable equals to 1 then the element will be printed.
  • 7. Google Developer Student Clubs CET-B WEEK-2 EDITORIAL
  • 8. CET-B DAY-7 Problem Statement: Himansh loves billiards very much. One day while playing a match , he found out a new trick in the game. He interpreted each red balls as 0 and each white balls as 1 .He started taking a note of the positions of white and red balls in the table. If there are at least 6 balls of same color placed one after another, then the situation is considered dan- gerous else its out of danger. Approach: After taking the input string, with the help of pre- defined function taking a string containing six 0's and six 1's compare and search if that string is found inside the main input string . If it is found then print "DANGEROUS" else "NOT DANGEROUS".
  • 9. CET-B DAY-8 Problem Statement: While checking the English papers of the board exams ,the professor often gets frustated by the writing format of words of the student in the examination paper. The words were a net mix of upper case and the lower case letters in every words. An idea struck into the mind of the professor to develop an extension that would change the letters' register in every word so that it either only consisted of lower case letters or, vice cersa, only of uppercase ones. At that as little as possible letters should be changed in the word. For example, the word HoUse must be replaced with house, and the word ViP — with VIP. Approach: After taking the input check how many upper case and lower case letters are present by using a count variable. If more number of lower case are present then convert the whole string to lowercase else convert it to uppercase.
  • 10. CET-B DAY-9 Problem Statement: There are n students standing in a row for a drill. They are given Red(R), Blue(B) and Green(G) colored tshirts. The instructor wanted to remove some students from the row such that two neighboring students don't have the same color tshirts. Students in a row are considered neighboring if there are no other students between them. Approach: Create a loop which take iteration for every charac- ter in an input string and check whether the character is equal to it's adjescent character. If it is so then increase the value of variable by one which was initially declared as zero. Finally print the value of variable after the loop over. Repeat the process for number of test cases.
  • 11. CET-B DAY-10 Problem Statement: A primary school teacher has taught the students english alphabets. He now wants to test the students. He has given his n students a task to write sentenc- es with every alphabet occuring atleast once. He has taught the students only lowercase alphabets. Given a string without spaces findif every alphabet of english language has occured atleast once. If the student has passed the test the teacher gave them a pass mark.The sentences need not be meaning- ful. Approach: Create an integer array of size 26 where each place represent the ascii character of each lower case alphabet. Then just increment the values in the appropriate places when that character appear in the sentence. Loop through the characters of the string and sub- tract the ascii from 97 to get values ranging from 1-26 then increment the value in the array. Then check if any position is having value 0 then print fail else pass.
  • 12. CET-B DAY-11 Problem Statement: There are n marbles in a row. A child has to divide the marbles in halves untill he gets one marble. Find the minimum number of steps required to get the single marble. The halves can be unequal for odd numbers. After a division from odd even pair the child has to choose the even pair for futher division if the odd number is not 1. Approach: First you need to enter the number of marbles in a row. Then keep on dividing the number of marbles till there is only one marble left. Count the minimum number of steps required to get a single marble. If the number gets divided to and even and odd number, continue the division with the even one.
  • 13. CET-B DAY-12 Problem Statement: Given a square matrix, calculate the absolute difference between the sums of its opposite rows and opposite columns. For example, the square matrix arr is shown below: 1 2 3 7 5 6 9 8 9 The sum of the rows = 1+2+3+9+8+9= 32. The sum of the columns = 1+7+9+3+6+9= 35. Their absolute difference is |32-35|=3. Approach: ake the matrix as input.Then add all the elements of first row with that of the last row and store in a variable. Add all the elements of first column with that of the last column and store in another variable. Print the absolute difference between them.
  • 14. CET-B DAY-14 Problem Statement: There are n students in a class. They are given numbers according to their height, like if two students have same heights they are given same number. They are arranged in a pyra- mid manner. A pyramid manner is basically a sequence of numbers, with initially an increasing order, then the peak, then a decreasing order, look- ing like a pyramid. Now, the class teacher needs to find the place where the tallest student is standing. Approach: Initially create two variable, the first variable store the starting index and second variable store the ending index of input array. Then create a continuous loop which ends when both the variable have same value. In each iteration find the middle index and com- pare the value at that position with upper value, if it is greater then second variable should store the middle index else first variable should store the upper middle index. Repeat this until the loop over. After the loop over print the upper index of first variable.
  • 15. Google Developer Student Clubs CET-B WEEK-3 EDITORIAL
  • 16. CET-B DAY-15 Problem Statement: There are n students appearing an online exam. Each of them are given serial numbers starting from 1 to n. No two students can have the same serial number. Each of the students are asked to write their serial numbers on the top. One of the student copied all the answers from another student. He forgot to change his serial number and submitted his answer sheet with the other students serial number. Find the student who cheated. The teacher has recieved the answer sheets in a random manner. If no students has cheated print 0. Approach: Create a continuous loop which occurs for t times, t is the number of test cases. In each iteration take inupt array and store in a variable. Then create two loop to check which number is missing in the range from 1 to n. finally print the missing number.
  • 17. CET-B DAY-16 Problem Statement: Mirsha is a computer science student in her final year. During a certain event, she was faced with an interesting problem. Given a list of numbers, all except one numbers follows a certain odd-even pattern. Basically this means, from the list, 1 number will be odd, and rest even, or vice versa. Your task is to find the index of the number which doesn't follow the pattern. The indexing here starts from 1. Approach: Initialize two variable k1 and k2 with integer value zero. Then for each number in the array check if it is even or odd, for even number increase the value of k1 by and for odd number do same with k2. Finally if k1 is greater then k2, then find the index of odd number and print it else find the index of even number and print it. Repeat the process for all test cases.
  • 18. CET-B DAY-17 Problem Statement: A company decided to start a lucky draw for its customers. The company gave its customers a lucky draw coupon with a serial number printed on it. The serial number ranges from 1 to n. The company devised a rule to decide the lucky numbers:- -Starting with the serial number, replace the serial number by the sum of the squares of its digits. -Repeat the process until the number equals 1 (where it will stay), or it loops endlessly in a cycle which does not include 1. -Those numbers for which this process ends in 1 are lucky. The customers are asked to submit their tickets at the counter and their serial numbers are checked their and lucky or unlucky is printed over their tickets based on their serial number. Approach: After taking the input first check if the number is greater than 9 or not. If smaller than 9 then its unlucky. Then calculate the sum of each digits in the number and if it results to something other than 1 then the number will be the sum and like this it checks in a loop.
  • 19. CET-B DAY-18 Problem Statement: A number of balls are kept in a basket each named in the range [1,n]. some students picked few balls randomly and changed their numbers to existing numbers in the box and then added back. Now box has unique numbers + duplicate num- bers. Find the original numbers on the balls whose numbers were changed. Approach: First input the number of test cases. Input size of array(arr[]) and then input the array elements. Then another array(reg[]) has been created to check which all elements are present in the array from 1-n. The value of this array will contain eiher 1 or 0 depicting which elements are present(val- ue=1) and which are absent(value=0). Once it's done, Then we once again traverse this reg[] array and print the index value where the value is 0(depicting absent).
  • 20. CET-B DAY-19 Problem Statement: Given a number of balls placed on top of each other in an order. It is kept in such a way that the number of balls goes on increasing in a column and then decreasing which resembles a mountain pattern.Jonita has been asked by her teacher to find whether the mountain has steep slope or gentle slope. Help Jonita solving out this problem. Approach: In this problem four loop is required. Using first loop store the largest value from array in a variable. In the second loop find the index for lagest value from the array and name it middle_index. then divide the array into two part from middle_index. In the 3rd loop check if any number repeat in first part of array and if so then print "gentle" and break the loop, if not go to 4th loop. In 4th loop check if any number repeat in second part of array if so print "gentle" and break the loop, if not then just out from the loop and print "steep".
  • 21. CET-B DAY-20 Problem Statement: Tony has been assigned a number n and was asked to represent it as a sum of maximum possible number of prime numbers.One can prove that such represen- tation exists for any integer greater than 1. Help Tony to solve this problem. Approach: First check the number n is even or odd. For even number print "n/2" then print "2" for n/2 times and for odd number print interger value of n/2 then print (n-3)/2 times "2" and one times "3". Repeat this process for all test cases.
  • 22. CET-B DAY-21 Problem Statement: A baker wants to raise some yeast in a container for making bread. Initially, the container is empty. Each morning, the baker can put any number of yeast into the container. And each night, every yeast cell in the container will split into two yeast cells. You hope to see exactly x yeast cells in the container at some moment. What is the minimum number of yeast cells the baker needs to put into the container across those days? Approach: Initialize an integer variable k with zero. Check if the input integer is odd number then increase k by one and the new value of n should be (n-1)/2 , if number is even then just change n to n/2. All these process should be under an continuous loop whose boolean value always be True, if n reach to one then break the loop by incresing k by one. Finally print the value of k. Repeat the process for all test cases. Or, FUNCTION TO SOLVE FOR N Basically we need to form n(given number) as a sum of powers of 2 for example take 15 15 = (2^3) + (2^2) + (2^1) + (2^0) and as it is clear there is no better way than expressing the number in binary 15 = 1111 to express 15 we need 4 powers of 2 (therefore 4 1's in the binary form of 15) hence the answer to n is the number of 1's in the binary form of n verify this on 5 5 = 0101 thus the answer is 2 Set a counter 'ctr' for counting no. of 1's In the end: for (int m = n;m>0; m/=2) { ctr += m%2; } return ctr;