Thinking with visuals - Part 2
Lesson Objective
We have already covered 3 different types of puzzles in the previous lesson of thinking with visuals. This lesson will be the continuation of the previous lecture and we will discuss some more puzzles in this lecture. This is a self-paced class.
Takeaways from the previous lesson
The most important takeaways from the previous lesson were:
- Look for some pattern to solve the puzzles
- Get clarity on the problem before looking for solution
- Involve Problem solving steps like understanding the context, identify the possible solution and check the best-fit.
So what are you waiting for?
Source: Giphy
About the lesson:
In this lesson we will be dealing with various types of visual, logical and reasoning problems. You will be made to think deeper and we hope you find this lesson very interesting. In the previous lessons we learnt about various visual resonings, now it’s time to go deeper in them. Happy learning!!
1. Missing Terms:
What are they?
These are the kind of problems in which you will be given some images and a missing area, and you will be asked to predict what can be filled in place of the blank area that fits best from all the options provided. It should follow the trend others are following or display.
How do we think and approach such questions?
At the first glance it seems to be a question that involves height level thinking and visualisation. Analyse and observe the pattern followed in the consequent images and apply the same to get the rest of the pattern.
Example 1: Find the missing part
How to approach
Let us discuss example 1. Here you can see that we have 3 rows and 3 columns and the right-bottom most cell is missing from it. Our task is to select one of the figures from the options that fits in the pattern, replacing the question mark. Observe the patterns in the first two rows. If you observe carefully, the method of obtaining the third figure in each row is the removal of common elements between the first two figures and then adding the rest of the elements to achieve the final output. Another way to visualise this is to remove the overlapping part from both of the figures and you will get the correct final output.
Solution: The answer is option E.
This problem will help you ace other problems related to pattern matching and trend analysis in competitive programming.
Follow up
Now try to solve the remaining examples on your own. We hope you understand the concept involved in solving such problems. It is an essential skill in solving a coding problem.
Follow up questions
Question 1:
Check the Solution!
The answer is option 3.
For every edge shared by two triangles, the arrows from both
of its sides mirror one another.
Question 2:
Check the Solution!
The answer is option E.
In each row, the figures are rotated by 90 degrees in
clockwise direction.
Question 3:
Find the missing part
Check the Solution!
From the figures in row 1 to row 2 the shaded row/column of the figure is shifted by one position. Hence the answer is option f.
2. Colouring Patterns:
What are they?
These are equations consisting of various images having either white, grey or green colour in the circles and you have to predict the colour of circles in the figures given in the last row, below the black line.
How do we think and approach such questions?
When you first scan the question it appears to be conditional based which requires you to check various conditions before coming to a conclusion. Try to identify what is unique in a figure with the same colour and take note of that while answering the query images below and you will get the correct answer.
Example 1:
How to approach
Step one in reaching the desired conclusion is to note down various conditions the image has for similar colours. Let’s dry run this idea, for the first example. Visualise the content of the boxes having green coloured bubbles. You may notice that all the boxes which have numerical values within range of 5 to 9 are marked with green colored bubbles, while those which have numerical values in the range of 0 to 4 have their bubbles colored in grey. Make a note of this and keep a track of each step followed in the entire thought process. Now, let's use these conclusions to answer queries. The 1st box has all numbers in the range of 5 to 9 so it will be green Similarly, the 2nd and 3rd boxes have all numerical values in the range of 0 to 4 so they will be coloured grey. And the 4th box’s numerical values lie in the range of 5 to 9, so it will be assigned the colour green.Kudos you have arrived at the right solution!
Solution:
Pattern: Green → Number range is 5 to 9
Grey → Number range is 0 to 4
This question will enable you to think deeper, ask you to check various possible cases and therefore increase your logic building quotient.
Follow up
Try to solve the remaining examples on your own and explore more such problems available on the internet. Developing this thinking and analysis pattern is crucial for solving future coding related problems.
Follow up questions
Question 1
Check the Solution!
Grey Green Grey Green
The pattern followed here is as follows:
Green → A specific letter ( H/N/D) repeats 5 times in the grid.
If no repetition is observed then the bubble will grey .
Question 2:
Check the Solution!
Grey Grey Green Green
The pattern followed is as follows:
Green → All the elements at the corners are the same.
If the elements at all four corners are not the same then the bubble is grey .
Question 3:
Check the Solution!
The pattern followed is as follows:
Grey 🡪 All elements of vertical diagonal are same.
3. Logic First, Code next:
What are they?
In this session we will try to analyse the question and attempt to build a sound logic to achieve the desired output.
Way of thinking and dealing with such questions?
The key way to start attempting such questions is to first understand what the question demands and what are its constraints. The following example is asking you to obtain a seat no. from the user and output the type of berth at which the seat can be found. This output should be obtained using some mathematical concepts rather than manual work/coding. A keen observation to be made in this category of problems is that they repeat their pattern at some instance of time. Try to visualise the pattern before attempting to solve the question. Ask yourself, is it repeating the same pattern after a few number of steps? If yes then try to follow the pattern and obtain a solution from that.
Example 1:
How to approach:
We believe that it is common knowledge that a railway coach is divided into various compartments of 8 seats. Since the total number of distinct types of seats are 8, we can conclude that it will repeat the same pattern consequently. If the pattern is repeated after each leap of 8, this implies that for every possible remainder of (seat no.)/(8), we will get the same output.
Here seat 1 is the lower berth so as per our assumption seat (8+1) would also be the lower berth. (2*8 + 1) would be the lower berth as well and so on. This is because they all get a remainder of 1 when divided by 8. So, if you were asked to output the type of seat for any seat number x, then the output will follow following criteria:
- If remainder is 1 it will be lower
- If remainder is 2 it will be middle
- If remainder is 3 it will be upper
- If remainder is 4 it will be lower again
- If remainder is 5 it will be middle again
- If remainder is 6 it will be upper again
- If remainder is 7 it will be side lower
- If remainder is 8 it will be side upper
(Now, dry run this logic for seat no. 9,10,11,12,13,14,15,16. You will see that you get the same output).
This problem gives you a glimpse of the kind of questions you will see in competitive programming (It generally appears in codeforces div 2 A,B).
Follow up
Now try to solve the remaining examples on your own. This is the bridge to problem solving using programming and is an essential topic to grasp if you want to be able to solve any problem statement given to you.
Follow up questions
Question 1:
Key idea: Find the digital root of a given number.
Digital root is found by adding the digits of the number until we get a single digit.
Eg.: Digital root of 698 = 6+9+8 = 23 → 2+3 = 5
Logic 💡 9, if the number is divisible by 9. Else %9.
Question 2:
Key idea: Find the sum of the quotients when alternate positive odd numbers from 3 to 101 are divided by 2.
Logic 💡 The quotients will be odd numbers. We are required to find the sum of odd numbers so the answer obtained should be n2.
Question 3:
Key idea: Find the sum of numbers which are multiples of both 3 and 5 from 1 to 1500.
Logic 💡 Find the multiples of 15 (LCM of 3 and 5 is 15) in the first 1500 numbers and add them all together. These numbers would be 15, 30, 45, 60 and so on. A shortcut of doing this would be finding the number of the first 100 natural numbers and multiplying the result by 15.
4. Goal it:
What is it?
You will be given a grid like figure with various colored rectangular obstacles and two colored balls. Your task is to figure out the various steps and trace the path followed by any of the balls to reach another ball. You can shift the positions of the obstacles left-right and up-down depending on the empty spaces around them.
How do we approach and deal with such questions?
This problem is a trial and error problem that requires you to check various possible moves. Your answer will be the set of moves which brings the orange ball to drop down into the black hole. The best way to solve such problems is to always try and decrease some distance between the ball and the black hole with each move, by moving obstacles. Move the obstacles in such a way that it will make the ball reach its destination.
Example 1:
How to approach
We have previously discussed some ideas on how to approach such problems, now it's time to dry run that thought process on the 1st example.Let’s take the orange ball as the moving ball and the black hole as the target. The ball is in 1st row and hole is in the last row. The ball cannot be moved down as there is a brown rectangular obstacle. Our first move will be to shift the brown obstacle to the left end and move the ball to coordinate (2,4). Now move the brown block to the topmost row. The 2nd row is completely empty now, however there is a yellow obstacle in the 3rd row, so shift the yellow obstacle to the left end. You now have a clear path to the goal. .
Solution:
- Brown and Yellow block completely to the left end.
- Orange ball to coordinates (2,4)
- Brown block to the 1st row
- ball downward to the hole.
This is a type of problem that will drive you to think 3 to 4 moves ahead of the current condition.
Follow up
Now try to solve the remaining examples on your own.
Follow up questions
Question 1:
Check the Solution!
- Purple block – 1 row ↓
- Orange ball to coordinates (2,2)
- Green block – 2 rows ↑
- Purple block – 1 column ←
Question 2:
Check the Solution!
- Orange ball to coordinates (3,3)
- Green block – 1 row ↓
- Purple block – 1 column ←
Question 3:
Check the Solution!
- Purple block – 1 column →
- Orange ball to coordinates (1,3)
- Green block – 2 rows ↑
- Yellow block – 2 columns →
- Brown block – 1 row ↓
Question 4:
Check the Solution!
- Blue block – 2 rows ↑
- Yellow block – 1 column ←
- Purple block – 1 column →
- Pink block – 1 column → and 1 row ↑
- Brown block – 1 column ←, 2 rows ↑ and 1 column →
Under the hood 💡 To solve more such problems with visuals, you can refer to the lesson under the hood.