Minimum Energy to Clear a Pico VR Level Using Short Jumps

Last updated: November 29, 2026

Quick Overview

In a Pico VR rhythm level, platform i costs cost[i] energy to stand on; starting on platform 0 or 1 and jumping one or two platforms at a time, return the minimum energy to move past the last platform.

ByteDance
Coding & Algorithms
Software Engineer
ByteDance
November 29, 2026
Software Engineer
Online Assessment
Coding & Algorithms
Easy

0

0

0 solved


In a Pico VR rhythm level, platform i costs cost[i] energy to stand on; starting on platform 0 or 1 and jumping one or two platforms at a time, return the minimum energy to move past the last platform.

A light dynamic programming warm-up in the style of ByteDance online assessments, framed around a Pico headset game. The interviewer checks that you define the state precisely and reduce memory to two variables.

What the Interviewer Expects
  • Define dp[i] as the minimum energy to arrive at position i
  • Write the recurrence dp[i] = min(dp[i-1] + cost[i-1], dp[i-2] + cost[i-2])
  • Set dp[0] = dp[1] = 0 because the start is free
  • Reduce O(n) space to O(1)
  • Handle lists of length 0 or 1
Key Topics to Cover
1D dynamic programming
recurrence
space optimization
greedy pitfalls
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • Allow jumps of up to k platforms.
  • Return the actual platforms stood on.
  • Some platforms are broken and cannot be stood on: what changes?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements

Input: a list of non-negative costs. You may start on platform 0 or 1 at no charge, pay cost[i] when you leave platform i, and need to reach position n (past the end). Output: minimum total energy. Em...

High-Level Design

Let dp[i] be the cheapest way to arrive at position i. You arrive at i either from i - 1 (paying cost[i-1]) or from i - 2 (paying cost[i-2]). Since starting at 0 or 1 is free, dp[0] = dp[1] = 0. The a...


Submit Your Answer
Markdown supported