# Technical Interview Problems: Lists

A collection of common interview problems that use the Python List, and strategies for how to construct optimal solutions.

StartTechnical Interview Problems in Python: Lists

Lesson 1 of 1

- 1Lists are a fundamental data type in Python. Projects make extensive use of lists to store data in sequential order. You should expect
**at least**one technical interview question that requires wo… - 2For our first problem, we would like to “rotate” a list, or
**move elements forward**in a list by a number of spaces, k. Elements at the greatest index will “wrap around” to the beginning of the … - 3Optimizing a solution means reducing the memory required (space complexity), or reducing the number of instructions the computer must execute (time complexity). Sometimes this means entirely reth…
- 4We’ll continue our theme of list rotation by flipping the problem: given a
**sorted**list rotated k times, return the index where the “unrotated” list would begin. rotated_list = [‘c’, ‘d’, ‘e’, … - 5Our last problem had a sorted dataset as the input. Sure, it was rotated, but
**it started out sorted.**A sorted list gives us ways to leverage that ordering. After all, someone went through a lo… - 6Duplicate values? Who needs them! Given a list of values with duplicates, return a list holding the same values in the same order
**with all duplicates removed**. duplicates = [‘a’, ‘a’, ‘x’, ‘x’… - 7For the last problem our suggested solutions had O(N) time and/or O(N) space complexity. We can’t improve the time complexity. We have to visit each value to determine whether or not it is a dupli…
- 8Our next problem calculates sums within a list. Given a list of integers, return the
**maximum sum possible from a contiguous sub-list**. A sub-list is an uninterrupted portion of the list (up to… - 9Our last solution had a cubic time complexity: O(N^3). One iteration for the length of the list O(N), inside
**another**iteration for the length of the list O(N^2), inside the inner loop, we copi… - 10We’ll end with a classic interview question: given a list of integers and a “target” integer,
**return a pair of indices whose values sum to the target**. nums = [4, 2, 8, 9, 6] target = 8 pair_s… - 11We’ll explore a common trade-off: time vs. space. Our previous solution used nested for loops to iterate through each element in the list and then iterate
**again**for each element in the list to…

## What you'll create

Portfolio projects that showcase your new skills

## How you'll master it

Stress-test your knowledge with quizzes that help commit syntax to memory