Dolat Capital Pvt. Ltd | Oncampus | OA Round

Company Name: Dolat Capital Pvt Ltd.
Job Profile: Software Developer (C++)

There were 2 coding sections which comprised of 2 questions in each section.

- Section 1

1. First question was on flipping minimum number of bits to make the string identical. (Easy)

Example:
Given a binary string "11001", perform min operations on the string to make the binary string identical "11111".
Here I thought of counting 0's and 1's bit to determine which bit can be flipped minimum number of times to make the string identical.

2. It was on OOPS concept in C++, I don't remember the question exactly.

- Section 2

1. Students visiting Museum (Medium)

Given two arrays representing the sequence of students entering the museum and another one is a sequence of students leaving the museum.
Condition - The students who first enter in museum should be the first one to leave and same for the rest of students, if any student overtakes any one or breaks the sequence then they will be punished.
Find the number of students to be punished.

Example:
Input : entry = [3, 5, 2, 1, 4], exit = [4, 3, 2, 5, 1]
Output : 2
Explanation: In the above example 3 enters first, then 5 and so on..likewise while leaving 4 leaves first as given in the array which is not in a correct sequence, so 4 needs to be punished and same for 2 as well.
Therefore total of 2 students needs to be punished.

2. Union of Primes and Fibonacci (Medium)

Generate a sequence of prime numbers and fibonacci numbers less than N and form a union of both set of numbers.

Input : N = 10
Output : [0, 1, 2, 3, 5, 7, 8]

Explanation:- prime numbers less than 10 are [2, 3, 5, 7] and
fibonacci numbers less than 10 are [0, 1, 1, 2, 3, 5, 8]
Union of both primes and fibonacci are [0, 1, 2, 3, 5, 7, 8].

Connect with me on linkedin if you want any help

Comments (0)