PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/DocuSign

Find maximum island sum and required indices

Last updated: Apr 22, 2026

Quick Overview

This question evaluates grid-based graph traversal and connected-component aggregation skills, including handling positive and negative cell values, tie-breaking by row-major indices, and computing maximum component sums.

  • Medium
  • DocuSign
  • Coding & Algorithms
  • Software Engineer

Find maximum island sum and required indices

Company: DocuSign

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Technical Screen

You are given an m×n integer grid where 0 denotes water and any non-zero value denotes land. Two land cells are connected if they share an edge (4-directional). An island is a maximal set of connected land cells. Tasks: 1) Return the maximum sum of cell values over all islands. 2) Variant A: An island is considered valid only if all its cells are non-negative; any island containing at least one negative value must be ignored. Recompute and return the maximum sum under this rule. 3) For the island that achieves the returned maximum sum, also return one index (r, c) of any cell in that island (0-based). 4) Variant B: Instead of any index, return the last index of that island in row-major order (the lexicographically largest pair (r, c) by r first, then c). If multiple islands tie on sum, choose the island whose last index is largest under the same order. 5) Describe your algorithm and analyze its time and space complexity.

Quick Answer: This question evaluates grid-based graph traversal and connected-component aggregation skills, including handling positive and negative cell values, tie-breaking by row-major indices, and computing maximum component sums.

Related Interview Questions

  • Implement a key-value CRUD store - DocuSign (Medium)
DocuSign logo
DocuSign
Aug 7, 2025, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
11
0

You are given an m×n integer grid where 0 denotes water and any non-zero value denotes land. Two land cells are connected if they share an edge (4-directional). An island is a maximal set of connected land cells. Tasks:

  1. Return the maximum sum of cell values over all islands.
  2. Variant A: An island is considered valid only if all its cells are non-negative; any island containing at least one negative value must be ignored. Recompute and return the maximum sum under this rule.
  3. For the island that achieves the returned maximum sum, also return one index (r, c) of any cell in that island (0-based).
  4. Variant B: Instead of any index, return the last index of that island in row-major order (the lexicographically largest pair (r, c) by r first, then c). If multiple islands tie on sum, choose the island whose last index is largest under the same order.
  5. Describe your algorithm and analyze its time and space complexity.

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More DocuSign•More Software Engineer•DocuSign Software Engineer•DocuSign Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.