# Python Interview with an Amazon engineer

#### Watch someone solve the partition equal subset sum problem in an interview with an Amazon engineer and see the feedback their interviewer left them. Explore this problem and others in our library of interview replays.

Python interview with a FAANG engineer: Split array sum equally - YouTube  
[Python interview with a FAANG engineer: Split array sum equally](https://www.youtube.com/watch?v=38AxtkfV2js)

### Interview Summary

**Problem type**  
Partition Equal Subset Sum

**Interview question**  
Given an array of positive numbers, determine if the array can be split such that the two partition sums are equal.

Read more about the questions  
- [Partition Equal Subset Sum](/content/questions/partition-equal-subset-sum/index.html)

### Interview Feedback

**Feedback about Verdant Gyroscope (the interviewee)**  
Yes  
**How were their technical skills?**  
4/4  
**How was their problem solving ability?**  
4/4  
**What about their communication ability?**  
4/4

> You have amazing problem solving skills, You were able to quickly see through the problem and come up with a relevant approach, Your execution speed was phenomenal and you handled the follow up question quite well.  
> You didn't panic when you weren't getting the desired output but instead calmly debugged through the issue. I was particularly impressed by your ability to quickly translate your idea into code.

**Feedback about Atomic Snow (the interviewer)**  
Yes  
**How excited would you be to work with them?**  
4/4  
**How good were the questions?**  
4/4  
**How helpful was your interviewer in guiding you to the solution(s)?**  
4/4

> Great interview experience!

### Interview Transcript

**Verdant Gyroscope:** Hello?  
**Atomic Snow:** Hello.  
**Verdant Gyroscope:** Hi.  
**Atomic Snow:** How you doing?  
**Verdant Gyroscope:** Good.  
**Atomic Snow:** Awesome. So let's start with introductions, then we'll jump onto the coding question and get through that question. We can then try doing another one. Okay, Does that sound good?  
**Verdant Gyroscope:** Yeah.  
**Atomic Snow:** Awesome. So I am a backend distributed systems engineer, I basically work in one of the cloud-based internet companies. So do you wanna introduce yourself?

**Verdant Gyroscope:** Yeah, I'm a rising junior in college, University of Pennsylvania, studying computer science. And I'm preparing right now for coding interviews, for the internships I'll be applying to this fall for the summer after my junior year. So yeah, that's where I'm at. I've done I’ve been practicing pretty intensely for the past, like month or two, I would say, but I have a fairly long history of like, doing coding projects, and then study, I'm studying computer science. I would say I'm like, at an intermediate level.

**Atomic Snow:** At the intermediate level, awesome. Yep, that sounds great. Okay, you will, I'm pretty sure you'll be able to get your like more than one internship, cutting this down. So this will offer that. Thank you. Alright, so for today's coding question. Let's suppose you are given a list of positive integers. And we want to check if it is possible to break that set, or that list into two subsets such that the sum of both the subsets is equal.

**Verdant Gyroscope:** The sum of you say positive integers?

**Atomic Snow:** Yep, so for example, I'll just write it out here. Suppose your set is something like this. We just want to make sure that if you sum it up this set, this becomes 12 to 14, so is there a subset which can sum up to seven. So in this case, I say if I break it into this way, like one subset has four threes, and the other one has 511. So we know that it is possible to break it in such a way that the sum of both the halves are equal?

**Verdant Gyroscope:** Okay. So I'm thinking, the first thing is, if we sum up all of the numbers in the in the set? We get that total, then we're looking for any subset that matches the total divided by two, I guess.

**Atomic Snow:** That's right. Okay.

**Verdant Gyroscope:** Alright. So I think one strategy here would be to write a function to try and find a subset matching a target value. And I guess like our top-level function, we'll just use that function in passing the sum divided by two.  
And I think the way I would go about implementing that function to find the subset that summing up to a target value is so I think if we have like a table where the rows correspond to like, the target value, if it's a positive integer, and so that those would go from like, one to the sum divided by two, I guess. And then the columns would correspond to like, a slice, or like a partition in the, in the list. And like, we can assume that, like, we have access to the elements up to and excluding that, that index, and then and then I think there should be a way to kind of express the optimal value kind of like in a bottom-up approach code, you know, iterate through the table and set each entry of the table row using the values of previous entries. So that's, I would say that's the main approach. That would be like I guess, if S is the sum of all the elements in the list and the complexity of that... The time complexity would be like, O(s*n) where n is the length of the list. And the space complexity would be the same.
