PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Kneron

Compute sum of minima with removals

Last updated: Mar 29, 2026

Quick Overview

This question evaluates algorithmic problem-solving, array manipulation, and handling dynamic removals and indexing within the Coding & Algorithms domain. It is commonly asked to assess the ability to design efficient procedures, reason about edge cases and time complexity, and focuses on practical application and implementation skills rather than purely conceptual theory.

  • Medium
  • Kneron
  • Coding & Algorithms
  • Software Engineer

Compute sum of minima with removals

Company: Kneron

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Take-home Project

You are given an array weights[0..n-1] of positive integers representing product weights in a line. Repeat until no products remain: choose the lightest remaining product (if multiple, choose the one with the smallest current index), add its weight to a running total, and remove it along with up to its two current neighbors—one on the left and one on the right if they still exist. If only one neighbor exists, remove just that neighbor. Return the final total. Example: weights = [4, 3, 2, 1] -> choose 1 (remove 2 and 1), remaining [4, 3]; choose 3 (remove 3 and 4); total = 1 + 3 = 4. Implement a function that returns this total for any input array.

Quick Answer: This question evaluates algorithmic problem-solving, array manipulation, and handling dynamic removals and indexing within the Coding & Algorithms domain. It is commonly asked to assess the ability to design efficient procedures, reason about edge cases and time complexity, and focuses on practical application and implementation skills rather than purely conceptual theory.

Kneron logo
Kneron
Jul 26, 2025, 12:00 AM
Software Engineer
Take-home Project
Coding & Algorithms
1
0

You are given an array weights[0..n-1] of positive integers representing product weights in a line. Repeat until no products remain: choose the lightest remaining product (if multiple, choose the one with the smallest current index), add its weight to a running total, and remove it along with up to its two current neighbors—one on the left and one on the right if they still exist. If only one neighbor exists, remove just that neighbor. Return the final total. Example: weights = [4, 3, 2, 1] -> choose 1 (remove 2 and 1), remaining [4, 3]; choose 3 (remove 3 and 4); total = 1 + 3 = 4. Implement a function that returns this total for any input array.

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Kneron•More Software Engineer•Kneron Software Engineer•Kneron 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.