Introduction

Welcome to an exciting exploration of string manipulation and array operations! In this Unit, we’ll tackle a unique challenge: processing a string and an array in parallel while adhering to specific conditions. This engaging task is part of a mysterious book club's cryptic coding adventure.

Get ready to uncover the secrets of combining string and numerical logic into one seamless solution!

Task Statement

Our goal is to create a unique encoded message and manage an array of numbers simultaneously. Here's what we need to do:

  1. Replace each letter in a string with the next letter alphabetically. If the letter is 'z', wrap around to 'a'.
  2. For an accompanying array of numbers, divide each number by 2, round the result, and accumulate these rounded values.
  3. Stop processing once the accumulated sum exceeds 20.
  4. Reverse the updated string to complete the cryptic transformation.
  5. Return the reversed string and the unprocessed numbers from the array.

For example, given the input string "books" and the array [10, 20, 30, 50, 100]:

  • Start with an empty string and a sum of 0.
  • Process 'b' (becomes ) and (half is ), sum becomes .
Sign up
Join the 1M+ learners on CodeSignal
Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal