PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Capital One

Solve string merge and grid path tasks

Last updated: May 8, 2026

Quick Overview

This multi-part question evaluates string manipulation and sequence merging, stateful shortest-path planning under resource constraints (health-aware grid pathfinding), and sliding-window optimization for arrays/strings within the Coding & Algorithms domain.

  • Medium
  • Capital One
  • Coding & Algorithms
  • Software Engineer

Solve string merge and grid path tasks

Company: Capital One

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Take-home Project

##### Question Given two equal-length strings s1 and s2, create a new string by iterating i = 0 … n-1, comparing s1[i] with s2[n-1-i]: append s1[i]; if the two characters are identical append that character again, otherwise append s2[n-1-i]. Examples: s1 = "abc", s2 = "def" → "afcd"; s1 = "abp", s2 = "jda" → "aaaapj"; s1 = "abp", s2 = "abp" → "appa". Return the resulting string. Design an algorithm for a robot moving on a 2-D grid containing: walls (impassable), healing cells (+health), and monster cells (–health). Starting with a given health value, find the shortest path from start to goal such that the robot’s health never drops to 0 or negative. Output that shortest distance (or the path itself). Solve an array/string problem that requires a sliding-window technique to meet a given constraint (details unspecified in the notes).

Quick Answer: This multi-part question evaluates string manipulation and sequence merging, stateful shortest-path planning under resource constraints (health-aware grid pathfinding), and sliding-window optimization for arrays/strings within the Coding & Algorithms domain.

Related Interview Questions

  • Solve Four Coding Assessment Tasks - Capital One (medium)
  • Write SQL using joins and window functions - Capital One (medium)
  • Review Preprocessing Code and Tests - Capital One (easy)
  • Remove nodes with a given value - Capital One (medium)
  • Solve multiple algorithmic interview questions - Capital One (hard)
Capital One logo
Capital One
Jul 29, 2025, 8:05 AM
Software Engineer
Take-home Project
Coding & Algorithms
73
0
Question

Given two equal-length strings s1 and s2, create a new string by iterating i = 0 … n-1, comparing s1[i] with s2[n-1-i]: append s1[i]; if the two characters are identical append that character again, otherwise append s2[n-1-i]. Examples: s1 = "abc", s2 = "def" → "afcd"; s1 = "abp", s2 = "jda" → "aaaapj"; s1 = "abp", s2 = "abp" → "appa". Return the resulting string. Design an algorithm for a robot moving on a 2-D grid containing: walls (impassable), healing cells (+health), and monster cells (–health). Starting with a given health value, find the shortest path from start to goal such that the robot’s health never drops to 0 or negative. Output that shortest distance (or the path itself). Solve an array/string problem that requires a sliding-window technique to meet a given constraint (details unspecified in the notes).

Submit Your Answer

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Capital One•More Software Engineer•Capital One Software Engineer•Capital One Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,500+ 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.