Open In App

BrowserStack Interview Experience | Set 1 (On-Campus)

Improve
Improve
Like Article
Like
Save
Share
Report

Hi, BrowserStack recently visited our campus for written test for December placements. The written round was conducted on HackerEarth and was of 3 hours and had 2 coding questions.

1. Comment removal
Given a piece of code, the task was to remove all the comments from the code.

Eg. Input




int main(){
  // this is a comment
  int i = 1;
  /*
   some more
   comments
  */
  cout<<i;
  cout<<endl; // this is for new line
  return 0;
  // last one
}


Output:




int main(){
  int i = 1;
  cout<<i;
  cout<<endl;
  return 0;
}


PS : take special care of corner cases, how to deal with string properly.

2. JSON matching

Given two JSON objects, find the values of fields. whose values are different.

Eg. Input 
{"Geeks":"Test1","Are":"hey","Cool":"yeah"}
{"Geeks":"Test1","Are":"20","Cool":['B','C']}

Output:
Are:Cool 

PS : take special care of input and output format.

The questions were easy but the main task was to read the input correctly and string parsing related stuff.

Hope this will help you all.


Last Updated : 02 Jan, 2016
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads