InterviewBit academy

No, they have their own interface for that.

did you use recursion for the 3rd question

Nope iteration. Let’s a be the larger length string of the two(a and b are the input strings). Swap a and b if a is not longer in length than b.
Then this code should work. This is just a pseudo-code-

int length_a = a.length(), length_b = b.length();
if(length_a < length_b)
	swap(a, b);

int ptr_a = 0, ptr_b = 0;

// find if b is a sub-sequence of a
while(ptr_a < length_a && ptr_b < length_b) {
	if(a[ptr_a] == b[ptr_b])
		++ptr_b;
	++ptr_a;
}

// if all chars in b matches
if(ptr_b == length_b)
	cout << "yes, can pet";
else
	cout << "no, cant pet";

Whatever, i haven’t received the mail yet, I’m losing hope now :frowning:

same dude idk what is happening.

How many did you solve

They have interviews till 26 th, so don’t worry you may get an email soon. Otherwise why not ping them directly and ask if results are still pending for some students?

1 Like

Maybe they’re going through the applications in the order they came, i had applied for the course just before the deadline
I’ll ping them by the end of the day when i reach home. Thanks

1 Like

Possible, I had applied around a month before or so.

1 Like

Hope so
(10 chars)

3 and a half

You probably get in, you should ping them too. :slight_smile:

I checked the website, it says, ā€œCongrats, you have cleared the entrance test. As a next step please select a slot of 30 mins for personal interviewā€, but I didn’t receive any mail, Lol, I was worried, anyways, thanks for the support, good luck to all of you.

1 Like

What happens when the array is [1, 2, 2, 2, 2, 2], where will the upper bound pointer point at ??

1 Like

Didn’t know that there is also a case of direct selection .

You didn’t specify the number N, but lets take both 1 and 2
1-
lower_bound points to 0 and upper_bound points to 1. So, 1 - 0 = 1, and there only 1 instance of 1
2-
lower bound points to 1 and upper bound points to the end of the array that is 6, so 6 - 1 = 5 and there are 5 instances of 2.

1 Like

I meant n to be 2, anyways good solution, congrats on your selection!
Hopefully I’ll see you in IBAcademy then

1 Like

don’t you think the answer for the second question is 3!.5!.3!.6! , if the same type of fruits should be together and duplication is allowed

If same type fruit are together it’s 3!
Because we think of same fruits together as a single unit, looking at the question i think the examiner means that same type of fruits are idemtical

2 Likes

Share your approach for 5th question