Minimize cost & recommend movies

Quick Overview

This question evaluates algorithmic problem-solving and data-processing competencies, focusing on numeric optimization for making array elements distinct with minimal cost and on traversal and aggregation over a social graph to rank movies by friend and friends-of-friends frequency.

Minimize cost & recommend movies

Company: Amazon

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

##### Question Given arrays size[] and cost[] where size[i] is the size of the i-th product and cost[i] is the cost to increase size[i] by one unit, compute the minimal total cost required to increment elements so that all sizes become distinct. Implement recommendMovies(userName) that returns a list of movie titles ordered by how frequently they were watched by the user’s friends and friends-of-friends, using Helper.getFriends and Helper.getMoviesWatched.

Quick Answer: This question evaluates algorithmic problem-solving and data-processing competencies, focusing on numeric optimization for making array elements distinct with minimal cost and on traversal and aggregation over a social graph to rank movies by friend and friends-of-friends frequency.

|Home/Coding & Algorithms/Amazon
Amazon logo
Amazon
Jul 29, 2025, 8:05 AM
mediumSoftware EngineerTechnical ScreenCoding & Algorithms
19
0
Question

Given arrays size[] and cost[] where size[i] is the size of the i-th product and cost[i] is the cost to increase size[i] by one unit, compute the minimal total cost required to increment elements so that all sizes become distinct.

Implement recommendMovies(userName) that returns a list of movie titles ordered by how frequently they were watched by the user’s friends and friends-of-friends, using Helper.getFriends and Helper.getMoviesWatched.

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...