FastPrepHouse Robber I
Problems/House Robber I

House Robber I

InMobi logoInMobi● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an InMobi phone screen. A firsthand comment in an interview report names the standard House Robber I task and says it was coded, run, and optimized. It does not give the full statement, the signature, examples or limits. Our version is about 92% the same as the reported question.

You are given an integer array nums. The value nums[i] is the amount available in the ith house on a street.

You may choose any set of houses, but you cannot choose two adjacent houses.

Return the maximum total amount you can collect.

Function

rob(nums: int[]) → int

Examples

Example 1

nums = [2,5,1,3]return = 8

Choose the houses with amounts 5 and 3. They are not adjacent, and their total is 8.

Example 2

nums = [4,1,1,9,1]return = 13

Choose the first house with amount 4 and the fourth house with amount 9 for a total of 13.

Constraints

  • 1 <= nums.length <= 10^5
  • 0 <= nums[i] <= 10^4
  • The maximum total fits in a signed int.

More InMobi Phone Screen questions

  • Word Break IIPHONE SCREEN · Seen Aug 2026
  • Bus Station Seat AllotmentPHONE SCREEN · Seen Mar 2026
  • Find Missing and Duplicate IntegerPHONE SCREEN · Seen Mar 2026
  • Frequency Equals Card ValuePHONE SCREEN · Seen Mar 2026
  • Frog Position After T SecondsPHONE SCREEN · Seen Mar 2026
  • IPOPHONE SCREEN · Seen Mar 2026
  • Evaluate DivisionPHONE SCREEN · Seen Dec 2025
  • Compare Version NumbersPHONE SCREEN · Seen Feb 2022
  • Count Array DerangementsPHONE SCREEN · Seen Feb 2022
  • Maximum Frequency StackPHONE SCREEN · Seen Feb 2022

Similar questions at other companies

  • Maximum Subarray Sum with One DeletionServiceNow · PHONE SCREENServiceNow interview questions
  • Maximum Product of a Contiguous SubarrayLinkedIn · PHONE SCREENLinkedIn interview questions
  • Fewest Coins CombinationBloomberg LP · PHONE SCREENBloomberg LP interview questions
  • Longest Increasing SubsequenceByteDance · PHONE SCREENByteDance interview questions
  • Jump GamePaytm · PHONE SCREENPaytm interview questions
  • Query Words Within K PositionsPalantir · PHONE SCREENPalantir interview questions
  • House RobberVisa · PHONE SCREENVisa interview questions
  • Best Improvement Period of at Least K IntervalsAmazon · PHONE SCREEN
  • Longest Increasing SubsequenceAngel One · PHONE SCREEN
  • Match Shops and BuyersGoogle · PHONE SCREENGoogle interview questions
All InMobi interview questionsSee InMobi hiring insights
Saved
class Solution {
    public int rob(int[] nums) {
        // write your code here
    }
}
Checking account…