List Concatenation
TIP101 Unit 1 Session 1 (Click for link to problem statements)
U-nderstand
Understand what the interviewer is asking for by using test cases and questions about the problem.
- Can I assume the input will always be a list?
- Yes.
P-lan
Plan the solution with appropriate visualizations and pseudocode.
General Idea: Write a function that takes one list as input and returns that list concatenated with itself.
I-mplement
def concatenate_list(nums):
return nums * 2
OR
def concatenate_list(nums):
return nums + nums