FastPrepRearrange a String Outside In
Problems/Rearrange a String Outside In

Rearrange a String Outside In

ZipRecruiter logoZipRecruiter● EasyNEW GRADOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A ZipRecruiter new-grad OA report describes the outside-in order first, last, second, second-last, and examples for even and odd lengths. We supplied limits and a function signature.

You are given a string text. Build a new string by taking the first remaining character, then the last remaining character, and continuing inward.

If the length is odd, append the middle character last.

Function

outsideIn(text: String) → String

Examples

Example 1

text = "abcdef"return = "afbecd"

The pairs are a/f, b/e, and c/d.

Example 2

text = "abcde"return = "aebdc"

The pairs are a/e and b/d, followed by the middle c.

Constraints

  • 0 <= text.length <= 100000

More ZipRecruiter Online Assessment questions

  • Four-Level Banking System with Scheduled PaymentsOA · Seen Oct 2026
  • Count Three-Digit Numbers with Distinct DigitsOA · Seen Oct 2024
  • Longest Frequency-Bounded SubarrayOA · Seen Oct 2024
  • Minimum Changes to Draw a YOA · Seen Oct 2024
  • Apply Binary State OperationsOA · Seen Sep 2024
  • Simulate Orchard Rot SpreadOA · Seen Sep 2024
  • Compare Odd- and Even-Index SumsOA · Seen Sep 2024
  • Coordinate Removals with Column GravityOA · Seen Sep 2024
  • Lexicographically Smallest End ReversalOA · Seen Sep 2024
  • Recursively Expanded Shell Command CountsOA · Seen Sep 2024

Similar questions at other companies

  • Rearrange String by Alternating EndsHudson River Trading · OAHudson River Trading interview questions
  • Alternate String EndsCapital One · OACapital One interview questions
  • Run-Length String CompressionSalesforce · OASalesforce interview questions
  • Minimum Changes for Palindromic BlocksCitadel · OA · PHONE SCREEN · ONSITE INTERVIEWCitadel interview questions
  • Count Binary SubstringsMicrosoft · OAMicrosoft interview questions
  • Check a Repeated String as a SubsequenceQuince · OAQuince interview questions
  • Reverse String In PlaceThe Walt Disney Company · OA · PHONE SCREENThe Walt Disney Company interview questions
  • Lost MessagesSuperhuman · OASuperhuman interview questions
  • Reverse a StringFlexTrade · OAFlexTrade interview questions
  • Missing WordsVanguard · OAVanguard interview questions

ZipRecruiter interview experiences

  • ZipRecruiter SWE OA, Level Not Reported: 23 Experiences
  • ZipRecruiter SWE Intern OA Scores: 4 Experiences
  • ZipRecruiter SWE New Grad OA: 9 Experiences
All ZipRecruiter interview questionsSee ZipRecruiter hiring insights
Saved
class Solution {
    public String outsideIn(String text) {
        // Write your code here.
    }

}
Checking account…