Hackwithinfi questions

Any one who is done with hackwithinfi today please post your questions… I know you might not have took photo or Screenshot but it you will tell us what were your questions this will be very helpful… And please share your experiences about difficulty level of questions… This will be very helpful if any one can help​:blush::blush::blush:

4 Likes

Yes please share the question statements, or just tell us what type of questions were there or the difficulty level.

5 questions will be there. but each person got 3 questions only randomly which are not our choice.
I know 2 questions only from my seniors,
1st one:
A string is there which consists of and | .we have to calculate how many * are in between consecutive | in the substrings.we have to print the array which consists of no of * between |.
eg:
string=|**|
|**
first_index=1(it starts with 1 not 0)
end_index=3
so, we have to print array like (2,1)
where 2 represents the number of stars between first ‘|’ and 2nd ‘|’
where 1 represents the number of stars between 2nd | and 3rd|.
eg:
string=|**|*
ans:(0)
because there is no consecutive | in the string

2 Likes

2nd one:
there is a string which consists of only vowels.
we have to find out how many substrings are there in the given string .but,one thing that substring consists all vowels .any vowel can be repeat.
eg:
string=“aaeioua”
now we have to print the no of strings are 4
1st substring:aaeiou
2nd string aeiou
3rd string:eioua
4th string aeioua

2 Likes

there can be one more aaeioua?

for the first example, don’t we have to print the array (2, 2) instead of (2, 1)?

1 Like

can you please explain the forst question looks little confusing

Yeah, please explain the first question. Also, the string itself can be considered as a sub string right in the second question?

How 4 is answer as u said that string contains only vowels and substring also contain vowel then total substring will be n*n-1/2

Yeah, exactly what I think, count the vowels and take up all possible combinations

its not a sub string right.its given string .we have to calculate only subsrings

1 Like

sry 4 that for my mistake.
string=|||
yes.as u said array that we have to print is(2,2)

i am not able to get your point of you in calculating vowels like the formula .i think if you just go through the string then u can able to catch it.

No I think u didn’t explain question clearly…

1 Like

how you give formula to that query? can i know?

hay pleaese explain my first question looks little consfusing pleaseee

Actually if you said that the original string contains only vowels and you have to count the substance which have vowels only so can you please explain me that only was in how is the possible that in substrings there may be other than vowels.

And plz can u explain your question with another example

I think the approach to the 2nd question may be like this:
((no of vowels) * (no of vowels -1)/2) - (no of duplicate vowels)

see if i take an another example that is
string=aeioua
for this ans is 2
aeiou-1
eioua-2
those r two substrings
which contain all vowels
we can take another substring “aeio”,but it doent have all vowels
so we dont calculate that
“all substrings are not the substring which contain all vowels”
but all substrings which contain all vowels are substrings to the given string
eg:
aaeiuao
see for this ans is only 1
that is “eioua”

dont bother abt duplicates