Capgemini Exceller OA Questions and Solutions | Move Hashes to Front & String Compression

Capgemini · Question · Posted Jun 2026

Problem 1 - Move Hashes to Front Problem Statement You are given a string str containing letters, digits, spaces, and hash symbols (#). Your task is to move all hash symbols to the beginning of the string while preserving the relative order of all remaining characters. Return the modified string after all hash symbols have been shifted to the front. Constraints Constraint Value String Length 1 <= length(str) <= 10^4 Characters Letters, digits, spaces, and '#' Test Cases Input Output ...

The full answer & interview discussion are available to premium members.

Log in Create a free account