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 skip the character to be removed.
Build a new string by appending cha...read more
Help your peers!
Add answer anonymously...
Expedia Group Software Developer interview questions & answers
A Software Developer was asked Q. Knight Probability in Chessboard Calculate the probability that a knight remains...read more
A Software Developer was asked Q. Remove Character from String Problem Statement Given a string str and a characte...read more
A Software Developer was asked Q. Binary Tree to Doubly Linked List Transform a given Binary Tree into a Doubly Li...read more
Popular interview questions of Software Developer
A Software Developer was asked Q1. Knight Probability in Chessboard Calculate the probability that a knight remains...read more
A Software Developer was asked Q2. Remove Character from String Problem Statement Given a string str and a characte...read more
A Software Developer was asked Q3. Binary Tree to Doubly Linked List Transform a given Binary Tree into a Doubly Li...read more
>
Expedia Group Software Developer Interview Questions
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

