Open In App

BrowserStack Interview Experience | Set 4 (On-Campus)

Last Updated : 02 Dec, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

Online coding 3hrs
2 questions
20 marks each.

Problem 1:
Write a program which takes JSON as input and gives prettified JSON
a) You need to read JSON from STDIN. Input gives one line of uglified JSON.
b) Output should be formatted JSON.
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’] }
Ans: Are:Cool
Answer should be in above format ..

Problem 2:
Given a string and a Regular Expression pattern, give the number of the times the pattern occurs in the string. RegEx symbols mean as follows:
. – 2 occurrences of the previous character, + – 4 occurrences of previous character, * – more than 5 occurrences of the previous character

Sample Input (Plaintext Link)
5
aaaaaannndnnnnnnfffhfhhgjjjwkkkllclc
a.
n+
a*
an.
a.d.

Sample Output (Plaintext Link)
5
3
2
1
0


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads