google | Software Engineer | Interview Experience
Interview Date: Not specified
Result: Not specified
Difficulty: Not specified
Interview Process
The interview consisted of two questions, both of which included hidden test cases. Candidates were advised to pay attention to edge cases.
Technical Questions
-
Array, String
- Given an integer array
pointsof length N and a stringtokensof length N, where each character intokensis either ‘T’ (indicating the presence of a token) or ‘E’ (indicating an empty cell), calculate the total score where each token on the K-th cell adds points equal topoints[K]. Additionally, add 1 point for every pair of adjacent tokens.- Input:
- Integer array
pointsof length N. - String
tokensof length N containing characters ‘T’ and ‘E’.
- Integer array
- Output: An integer representing the total score.
- Examples:
- Input:
points = [3, 4, 5, 2, 3],tokens = "TEETT"→ Output:9 - Input:
points = [3, 2, 1, 2, 2],tokens = "ETTTE"→ Output:7 - Input:
points = [2, 2, 2, 2],tokens = "TTTT"→ Output:11
- Input:
- Input:
- Given an integer array
-
Dynamic Programming, Combinatorics
- Consider all codes made of four digits (0-9). How many of them have a sum of digits equal to S?
- Input: An integer
S, in the range [0, 36]. - Output: An integer representing the number of four-digit codes whose sum of digits is equal to S.
- Examples:
- Input:
S = 35→ Output:4 - Input:
S = 4→ Output:35 - Input:
S = 2→ Output:10
- Input:
- Input: An integer
- Consider all codes made of four digits (0-9). How many of them have a sum of digits equal to S?
Tips & Insights
Candidates should focus on edge cases and hidden test cases during problem-solving.