Skip to content

Commit cd4e576

Browse files
Merge pull request #1859 from chelsajoyful/school-puzzle
School puzzle
2 parents 04a0f22 + 5d9a9b8 commit cd4e576

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
module SchoolPuzzle where
2+
3+
import Prelude
4+
5+
-- This is a very simple one, assuming that they stop coming after a lesson (and cannot leave during a lesson)
6+
-- ans = n-1
7+
8+
howManyKidsHadAMark :: Int -> Int
9+
howManyKidsHadAMark numDays = (numDays - 1)
10+
11+
12+
{-
13+
Problem:
14+
15+
There is a school in a far far land. The teacher there teaches whatever he wishes to -- Physics,Maths,Biology, Astronomy, Philosophy, Psychology, English , Hindi and so on. There are 100 students in that school. The school has a uniques set of rules.
16+
1. No student is allowed to question the teacher or ask the teacher anything, they will just listen and follow whatever the teacher has taught them, without questioning him or asking any doubts.
17+
2. No student is allowed to speak to any other student. They just attend attend their classes and then go straight back to their hostel room and lock it from inside and stay there till the next day. They come out of their rooms only to attend their classes and go back as soon as their class is over.
18+
19+
One night god tells the teacher that he will put a mark on at least one students head indicating that that student has now attained all the knowledge in the world and could now leave the school. The teacher tells this to his students in the class the next day.
20+
God puts a mark on at least one student's head the next day.
21+
However since they cannot speak to each other, therefore other students cannot tell him that there is a mark on his head.
22+
On the 1st day after that, all 100 students come to the class.
23+
On the 2nd day again, all 100 students come to the class.
24+
This goes on till the 23rd day.
25+
On the 24th day however, some students stop coming to the class as they realised that they had a mark on their head.
26+
27+
How many students stopped coming to the class (i.e. had a mark on their head )? -}

0 commit comments

Comments
 (0)