# The most asked interview question¶

*Estimated time to read: 5 minutes*

Arguably, the most asked question in coding interviews is the Two Number Sum. It is used by many Bigtechs and AAA Game Studios. You can see this question in many youtube videos, coding websites such as hackerank, leetcode, algoexpert ...

# Agenda: Two Number Sum Coding Dojo¶

## Introduction (5 minutes)¶

- Welcome participants to the dojo
- Introduce the Two Number Sum question as a common coding interview question
- Discuss the importance of problem-solving skills in coding interviews
- Briefly explain the rules and structure of the dojo
- Problem Explanation (10 minutes)

## Provide a brief overview of the Two Number Sum question¶

- Define the problem and its requirements
- Discuss potential edge cases and constraints
- Review sample inputs and expected outputs
- Coding Session (50 minutes)

### Problem restrictions and characterization¶

Write a function that will receive an array/vector/list of integers and a target number. Find two numbers inside the array that summed will match the target. You have to return both in a array/vector/list ordered.

Implement the solution in 3 different ways. Open the details only after you try. First approach:

1. Naive solution. O(N^2) time and O(1) space; - required to know this;

Can you make it faster?

2. Fastest solution. O(N) time and O(N) space; - this will make you

Can you make it not use much memory, but still be fast?

3. Fastest without mem allocation. O(N*log(N)) time and O(1) space;

## Participants work on solving the Two Number Sum problem in pairs or small groups¶

- Emphasize the importance of communication and collaboration during the coding session
- Encourage participants to use a whiteboard or paper to sketch out their solutions
- Provide guidance and support as needed
- Code Review (20 minutes)

## Participants share their solutions with the group¶

- Facilitate a discussion about each solution, highlighting strengths and areas for improvement
- Encourage participants to ask questions and provide feedback to their peers
- Discuss potential optimizations and alternative approaches to the problem
- Wrap-Up (5 minutes)

## Recap the main takeaways from the dojo¶

- Encourage participants to continue practicing problem-solving skills on their own
- Thank participants for attending the dojo and provide any additional resources or support as needed.
- Note: The time allocation can be adjusted based on the group's needs and pace.