Open In App

BrowserStack Interview Experience | Set 3 (Coding Questions)

Improve
Improve
Like Article
Like
Save
Share
Report

Following is the written round questions for BrowserStack on campus.

Paper Duration: 2 hours
Number of Questions: 2
Maximum Marks: 2 * 20 = 40 marks


1. Sum all the digits of n!

Write a program that accepts a number n (in the range 1 to 2000) and outputs the sum of all the digits in the decimal representation of n!. For example: if n is 10, n! = 10! = 3628800. The output should be 27 in this case.

Sample Input: 9
Sample Output: 27

2. Regular Expression Match
Given a string and a regular expression pattern, give the number of times the pattern occurs in the string. RegEx example means as follows:
. – 2 occurrences of the previous character
+ – 4 occurrences of the previous character
* – more than 5 occurrences of the previous character

Sample Input:
5
aaaaaannndnnnnnnfffhfhhgjjjwkkkllclc
a.
n+
a*
an.
a.d.

Sample Output:
5
3
2
1
0

Explanation:
Input:
First Line: Number of sample test case (N)
Second Line: String
Next all will contain the RegEx.

The string will not contain the special characters that have already been mentioned. The pattern may contain parenthesis, in which case the special symbol has to apply on all the characters inside the parenthesis.


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