anonymous
BAN USER- 3of 3 votes
AnswersQuestion 1.
- anonymous in India
You are given a string composed of uppercase English letters (‘A’ through ‘Z’).
Set of letters (‘A’, ‘E’, ‘I’, ‘O’, ‘U’) are called vowels. Other letters are called consonants.
We define foo value of a string as number of pairs of exactly same consecutive vowel letters.
For example,
Ex.1: BCDEEIOU - This has a foo value of 1 (because of EE). Note that although I is next to E, and O is next to I, and U is next to O, they aren’t exactly same neighbours, so they don’t contribute to foo value
Ex.2: BCDEEEIOU - This has foo value of 2. Because of first pair of EE and immediately next pair of EE
Ex.3: ABCDEFG - This has foo value of 0. There are no consecutive vowels
Ex.4: ABEUUOUOO - This has foo value of 2, because of UU and OO
You are given 2 inputs, N and K.
How many strings of length N can you form such that they all have foo value of K?
Let’s assume the constraints as:
1<=N<=15
0<=K<N| Report Duplicate | Flag | PURGE
Google Software Engineer - 0of 0 votes
AnswersGiven a stream of numbers write a program that computes sum of pair of numbers. There should be two methods store and IsNumberPresent. The store should store the numbers and IsNumberPresent should check if the number is present in the computed sums.
- anonymous in India| Report Duplicate | Flag | PURGE
Linkedin Senior Software Development Engineer Algorithm
@Alex how would you call this?
- anonymous October 24, 2017also this
uint64_t count = prev_is_vowel
? Count(n - 1, k - 1, memo, true)
: Count(n - 1, k, memo, true);
should it not be
uint64_t count = prev_is_vowel
? Count(n - 1, k - 1, memo, true)
: Count(n - 1, k, memo, false);