← Questions

Four short array and string exercises

0
MetaCodingLast asked Dec 2025

Four quick problems in one round:

  1. Return the difference between the number of uppercase and lowercase letters in a string.
  2. Repeatedly subtract from the non-zero elements of an array, scanning from the left, until every element is zero, stopping a pass when you reach a value strictly smaller than the current one; report what the problem asks for at the end.
  3. Find the fewest unit increments that make an array either non-decreasing or non-increasing.
  4. Simulate a phone battery that charges and drains in cycles and answer the question about its charge.
Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding