BrowserStack Interview Experience | Set 3 (Coding Questions)
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
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.
If you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.