
Asked in Expedia Group
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...
Top Software Developer Interview Questions Asked at Expedia Group
Q. Knight Probability in Chessboard Calculate the probability that a knight remains...read more
Q. Binary Tree to Doubly Linked List Transform a given Binary Tree into a Doubly Li...read more
Q. Find Duplicates in an Array Given an array ARR of size 'N', where each integer i...read more
Interview Questions Asked to Software Developer at Other Companies
Top Skill-Based Questions for Expedia Group Software Developer
Algorithms Interview Questions and Answers
250 Questions
Data Structures Interview Questions and Answers
250 Questions
Web Development Interview Questions and Answers
250 Questions
Java Interview Questions and Answers
250 Questions
SQL Interview Questions and Answers
250 Questions
Software Development Interview Questions and Answers
250 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

