Duplicate a character - MATLAB Cody - MATLAB Central

Problem 1461. Duplicate a character

Difficulty:Rate

Duplicate a character 'n' times.

Example 1: str='a' n=5

output='aaaaa'

Example 2: str='*' n=3

output='***'

Solution Stats

38.17% Correct | 61.83% Incorrect
Last Solution submitted on Oct 21, 2025

Problem Comments

Solution Comments

Show comments
Join Cody Contest 2025 — Have Fun and Win Prizes!
...
We’re excited to invite you to Cody Contest 2025! 🎉 Pick a team,...
Dive Into Hands-On Learning at MATLAB EXPO 2025 – Register Now!
Get ready to roll up your sleeves at MATLAB EXPO 2025 –...
2

Problem Recent Solvers237

Suggested Problems

More from this Author9

Problem Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!