Belzabar Interview Questions


Array Questions Belzabar

Question 1. Smallest Element Repeated Exactly K Times We are given an array A[] on size n. We have to find the smallest element that is repeated exactly k times in the array. Example Input A[]= {1, 2 ,2 ,5 ,5 ,2 ,5} K=3 Output Smallest element with frequency K is: 2 Approach 1: Brute force Main idea ...

Read more

Question 2. First non Repeating Element We are given an array A. We have to find the first non repeating element in the array. Example Input: A[]={2,1,2,1,3,4} Output: First non-repeating element is: 3 Because 1, 2 is not the answer because they are repeating and 4 is not the answer because we have to find the ...

Read more

Question 3. Pair of Positive Negative Values in an Array In pair of positive negative values in an array problem we have given an array A of distinct integers, print all the pairs having positive value and negative value of a number that exists in the array. We need to print pairs in order of their occurrences. A pair whose ...

Read more

Question 4. Heap Sort Heap sort is a comparison based sorting technique that is based on a Binary Heap data structure. HeapSort is similar to a selection sort where we find the maximum element and then place that element at the end. We repeat this same process for the remaining elements. Given an unsorted ...

Read more

String Questions Belzabar

Question 5. Smallest Element Repeated Exactly K Times We are given an array A[] on size n. We have to find the smallest element that is repeated exactly k times in the array. Example Input A[]= {1, 2 ,2 ,5 ,5 ,2 ,5} K=3 Output Smallest element with frequency K is: 2 Approach 1: Brute force Main idea ...

Read more

Queue Questions Belzabar

Question 6. An Interesting Method to generate Binary Numbers from 1 to n Problem Statement The problem “An Interesting Method to generate Binary Numbers from 1 to n” states that you are given a number n, print all the numbers from 1 to n in binary form. Examples 3 1 10 11   6 1 10 11 100 101 110 Algorithm The generation ...

Read more

Question 7. Sorting a Queue without Extra Space In sorting a queue without extra space problem we have given a queue, sort it using standard queue operations without extra space. Examples Input queue = 10 -> 7 -> 2 -> 8 -> 6 Output queue = 2 -> 6 -> 7 -> 8 -> 10 Input queue = ...

Read more