Amazon SDE 2 DSA round

Anonymous User
475
May 24, 2025
  1. You're given an array hval[] of size N, where each element represents the value of a house. A thief wants to maximize the total stolen value but cannot rob two adjacent houses.

follow up - In addition to not robbing two adjacent houses, the total value of stolen goods must be ≤ L (some limit).
Goal: Find the maximum value the burglar can steal without robbing adjacent houses and without exceeding capacity L.

  1. A teacher wants to distribute chocolates to students based on their exam marks.
    Each student must get at least one chocolate.
    A student who scores higher than their immediate neighbor(s) should get more chocolates than them.
    The goal is to minimize the total chocolates distributed
Comments (1)