FastPrepMaximize Movie Ratings With Skip Limit
Problems/Maximize Movie Ratings With Skip Limit

Maximize Movie Ratings With Skip Limit

Salesforce logoSalesforceFULLTIMEONSITE INTERVIEW

Updated Sep 2026

QuestionFunctionExamplesConstraints

Problem statement

You are given an integer array ratings, where ratings[i] is the rating of the i-th movie.

You may choose to watch or skip each movie, but you cannot skip two or more movies consecutively.

Return the maximum possible sum of watched movie ratings while respecting the skip constraint.

Function

maximizeMovieRatings(ratings: int[]) → int

Examples

Example 1

ratings = [-3,2,4,-1,-2,-5]return = 4

Constraints

  • 1 <= ratings.length
  • -1000 <= ratings[i] <= 1000

More Salesforce Onsite Interview questions

  • Count Increasing TripletsONSITE INTERVIEW · Seen Nov 2026
  • Longest Substring Without Repeating CharactersONSITE INTERVIEW · Seen Nov 2026
  • Reverse a Sublist of a Linked ListONSITE INTERVIEW · Seen Nov 2026
  • Rotting OrangesONSITE INTERVIEW · Seen Nov 2026
  • 3Sum SmallerONSITE INTERVIEW · Seen Nov 2026
  • Count Zero Request ServersONSITE INTERVIEW · Seen Nov 2026
  • Group Identical Tree LevelsONSITE INTERVIEW · Seen Oct 2026
  • Meeting Rooms IIONSITE INTERVIEW · Seen Oct 2026
  • Construct a Tree from Level-Order and Inorder TraversalsONSITE INTERVIEW · Seen Sep 2026
  • Maximize Monsters DefeatedONSITE INTERVIEW · Seen Sep 2026

Salesforce interview experiences

  • Salesforce Infrastructure SWE OA and Onsite: 1 Experience
  • Salesforce Experienced Backend SWE First Round: 1 Experience
All Salesforce interview questionsSee Salesforce hiring insights
Saved
class Solution {
    public int maximizeMovieRatings(int[] ratings) {
      // write your code here
    }
}
Checking account…