Remove Character from String Problem Statement
Given a string str
and a character 'X', develop a function to eliminate all instances of 'X' from str
and return the resulting string.
Input:
The first line contains a string without leading or trailing spaces.
The second line contains a character 'X' without leading or trailing spaces.
Output:
The output is a single line displaying the modified string.
Example:
Input:
hello world
o
Output:
hell wrld
Constraints:
0 <= N <= 10^6
, whereN
is the length ofstr
.- Process should complete within 1 second.
Note:
No need to explicitly print anything; assume that all necessary output operations have been handled.

AnswerBot
4mo
Develop a function to remove all instances of a given character from a string.
Iterate through the string character by character and exclude the specified character while constructing the new string.
Us...read more
Help your peers!
Add answer anonymously...
Siemens Software Developer interview questions & answers
A Software Developer was asked 10mo agoQ. Write a program to find duplicate elements in an array.
A Software Developer was asked Q. Write basic code.
A Software Developer was asked Q. Write a simple program.
Popular interview questions of Software Developer
A Software Developer was asked 10mo agoQ1. Write a program to find duplicate elements in an array.
A Software Developer was asked Q2. Write basic code.
A Software Developer was asked Q3. Write a simple program.
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

