You are on page 1of 45

Problem solving

fundamentals
Who am I?

Graduated from the University of Dhaka


Ahmed Shamim
Hassan
Worked at P1, Pathao, IPVision Ltd.,
Iterato UAB, MailerLite
Senior software engineer
GymRevenue
Currently working remotely.

Co-founder
Megaminds Learning
Session Agenda

1 Intro to problem solving: What,


why and How?

A few hands-on problem solving


2
practices
Rules for the session
1 Take pen and paper

Close Facebook, messenger


2
and other distractions

3 Silent your mobile


What is
'Problem solving'?
What is 'DSA'?
DSA = Problem solving?
Why tech companies hire
good problem solvers?

To find efficient solutions to To find new solutions to unique,


1 2
problems complex problems

3 Build better products 4 Grow a sustainable business


Why do we need to learn
problem solving?

1 Crack coding interviews

2 Become a better software engineer


You’ll learn how to understand the
1
problem and constraints better

2 You’ll ask the right questions

How problem-solving can


3 You’ll think before jump into coding
help you in your SE career?
You will learn to face
4
challenges and new problems

You’ll review your solution


5
before confirmation
Why do we need to learn
so many data structures
and algorithms?

1 To make better choices 2 To learn different kinds of


techniques

Complex problems require a


3 combination of different DSA
techniques
1 Databases

2 Git
Real life use cases
3 Redis

4 Caching, Memoization, JIT compiler


Find the next number!
Find the next number!
Find the next number!
Find the next number!
Find the next number!
Find the next number!
Find the next number!
Find the next number!
1 Fail to understand the problem

Not enough knowledge about


2 the solution method or the
context/pattern
Why we can't solve
a problem?
Understood the problem
3
but can’t code it

Trying to shape the problem to a


4
specific data structure or algorithm
How to be good at
problem solving?

Don’t memorise the exact Understand the concept and the


1 2
solution pattern of the problem

3 Implement the code by yourself 4 Be consistent, Practice regularly


Understand the problem/requirement
1 and constraints (ask clarifying
questions, if needed)

Problem solving
2 Break down the problem

3 Attack from different angles steps


Test your solution idea with
4 different sets of inputs (use
pen, paper and head)

Write code and validate (run


5
the code with test input sets)
Find the minimum value from a list

10, 3, 34, 3455, 167, 90, 5


What are the
'Fundamentals'?
N a t iv e D a t a
structures
Loops

Data types
L o g ic a l C o n d it io n a l
Operators Operators

R e c u r s io n s
How much math is required?
Golden weighted ball problem
Iterative Solution (Naive approach)
Recursive Solution
(Divide and conquer approach)
Recursive Solution
(Divide and conquer better approach)
How about 100 balls?
Let's find a general solution!
Let's find a general solution!
Let's find a general solution!
Let's find a general solution!
Dividing to 4 sets will give better result?
How about 100 balls?
How about 100 balls?
Common mistakes while
preparing for coding interviews

Solving only easy problems to


1
increase the number of solutions
5 Not having a proper strategy

2 Lack of persistence
6 Memorising the solutions

3 Only solving category based problems


Not mastering one specific
7
langauge

4 Solving in a lot of coding platforms


Where should I practice?

For coding interview preparation For absolute begineers

HackerRank CodeWars
https://www.hackerrank.com https://www.codewars.com

LeetCode CodinGame
https://leetcode.com https://www.codingame.com

Excercism
https://exercism.org
Task 1

Input: matrix = [[1,2,3,4],[5,6,7,8],[9,10,11,12]]


Output: [1,2,3,4,8,12,11,10,9,5,6,7]
Q/A time!
That's a wrap!
Thank you for participating!

You might also like