IDFC First Bank - Chennai

idfc first bank logo
idfc first bank
· Chennai
August 9, 2026 · 1 reads

Summary

I was asked to solve a House Robber variant with limited adjacency during an interview at IDFC First Bank in Chennai.

Full Experience

House Robber with Limited Adjacency (Circular)

Problem Statement

You are given an integer array nums where each element represents the amount of money in a house. The houses are arranged in a circle, meaning the first and last houses are adjacent.

You want to maximize the total amount of money you can rob under the following constraints:

Constraints

  • You cannot rob more than two consecutive houses (i.e., picking 3 consecutive houses is not allowed).
  • You can rob adjacent houses at most once. Across the entire selection, there can be at most one pair of adjacent houses.
  • Since the houses are in a circle, house 0 and house n‑1 are also considered adjacent.

Goal

Return the maximum amount of money you can rob without violating the above constraints.

Interview Questions (1)

1.

House Robber with Limited Adjacency (Circular)

Data Structures & Algorithms

You are given an integer array nums where each element represents the amount of money in a house. The houses are arranged in a circle, meaning the first and last houses are adjacent.

Constraints:

  • You cannot rob more than two consecutive houses (picking three consecutive houses is not allowed).
  • You can rob adjacent houses at most once; there can be at most one pair of adjacent houses in the selection.
  • House 0 and house n‑1 are considered adjacent due to the circular arrangement.

Return the maximum amount of money you can rob without violating these constraints.

📣 Found this helpful? Please share it with friends who are preparing for interviews!

Discussion (0)

Share your thoughts and ask questions

Join the Discussion

Sign in with Google to share your thoughts and ask questions

No comments yet

Be the first to share your thoughts and start the discussion!