Insert Dashes
STRING
ARRAY
Problem
Given a string s
and an array of integers indices
, insert dashes ('-') at the specified indices in the string and return the modified string. The indices array will not contain duplicate values.
Examples
insertDashes("HelloWorld", [5]) // returns "Hello-World" insertDashes("AddDashesHere", [3, 9]) // returns "Add-Dashes-Here"
Loading...