Facebook | Phone Screen | Remove comments from source code

Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2016-10-07Added By Anonymous
Source: Link

Company: Meta
Role: unknown
Interview Stage: Phone Screen
Location: unknown
Year: unknown

Original Post Content:

Given a file path represented as string, take this input string and remove all the comments in the file, print this file or save this to a new txt file by your choice.

cases to consider:
// comment
/*
* comment
*/
foo(); // comment

Comments