React.js - Interview Question - duplicate hashtag remover.

rajeshroyal

Rajesh Royal

Posted on August 12, 2022

React.js - Interview Question - duplicate hashtag remover.

Had an Interview for React.js frontend developer for one of the MNC company. The question they asked was to build a Duplicate Hashtag remover

Question Statement:

There has to be an textarea in which user can input as many hashtags as he wants, the tags will be separated by a space and starts with # symbol.

Now the task is to find the duplicate hashtags entered by user and and show the listing below the textarea input. In the listing there has to be a X delete button by clicking on it it will remove the duplicate from the textarea as well as from the listing of duplicates.

Sample Input:

#kashmir #kashmirvalley #srinagar #dallake #reels #trendingreels #reelitfeelit #viral #viralvideos #viralvideos #viralreels #feelkaroreelkaro #mountains #love #couplegoals #bucketlist #moretocome #2022   #srinagar #dallake #reels #trendingreels #srinagar #dallake #reels #trendingreels #srinagar #dallake #reels #trendingreels #love #bucketlist
Enter fullscreen mode Exit fullscreen mode

Sample Output:

#kashmir #kashmirvalley #srinagar #dallake #reels #trendingreels #reelitfeelit #viral #viralvideos #viralreels #feelkaroreelkaro #mountains #love #couplegoals #bucketlist #moretocome #2022 #bucketlistour
Enter fullscreen mode Exit fullscreen mode

Solution CodeSandbox link - Duplicate Hashtags Remover

Time Duration - 1hr.
Interviewer was very nice and was helped when I was stuck at updating the state particularly.

Thank you for reading. Let me know if this is helpful and you can also share your questions in the comment box. (only the live coding or assignment questions.)

💖 💪 🙅 🚩
rajeshroyal
Rajesh Royal

Posted on August 12, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related