All Medium Articles

## Stock Buy Sell to Maximize Profit 3.1

The cost of a stock on each day is given in an array, find the max profit that you can make by buying and selling… Read More »

## Remove BST keys outside the given range 3.3

Given a Binary Search Tree (BST) and a range [min, max], remove all keys which are outside the given range. The modified tree should also… Read More »

## Find the maximum repeating number in O(n) time and O(1) extra space 3.4

Given an array of size n, the array contains numbers in range from 0 to k-1 where k is a positive integer and k <=… Read More »

## Comparator function of qsort() in C 3.1

Standard C library provides qsort() that can be used for sorting an array. As the name suggests, the function uses QuickSort algorithm to sort the… Read More »

## Microsoft Interview | 17 3

Recently i was interviewed for Build Team Engg. role in Microsoft hyderabad. I was selected. I am really thankful to GeeksForGeeks site which gave me… Read More »

## Merge Overlapping Intervals 3.2

Given a set of time intervals in any order, merge all overlapping intervals into one and output the result which should have only mutually exclusive… Read More »

## HeapSort 3.2

Heap sort is a comparison based sorting technique based on Binary Heap data structure. It is similar to selection sort where we first find the… Read More »

## Python Program for Heap Sort 3.5

Heapsort is a comparison based sorting technique based on a Binary Heap data structure. It is similar to selection sort where we first find the… Read More »

## C Program for Merge Sort 3

Merge Sort is a Divide and Conquer algorithm. It divides input array in two halves, calls itself for the two halves and then merges the… Read More »

## Zigzag (or diagonal) traversal of Matrix 3.1

Given a 2D matrix, print all elements of the given matrix in diagonal order. For example, consider the following 5 X 4 input matrix. 1… Read More »

## Data Structures | Binary Search Trees | Question 12 3

Consider the following code snippet in C. The function print() receives root of a Binary Search Tree (BST) and a positive integer k as arguments.… Read More »

## Swap all odd and even bits 3.1

Given an unsigned integer, swap all odd bits with even bits. For example, if the given number is 23 (00010111), it should be converted to… Read More »

## C | Storage Classes and Type Qualifiers | Question 19 3

Output? filter_none edit close play_arrow link brightness_4 code #include <stdio.h> int main() {   register int i = 10;   int *ptr = &i;   printf(“%d”, *ptr);   return… Read More »

## A Pancake Sorting Problem 3.6

We have discussed Pancake Sorting in the previous post. Following is a problem based on Pancake Sorting. Given an unsorted array, sort the given array.… Read More »

## Operating Systems | Process Management | Question 6 3

Three concurrent processes X, Y, and Z execute three different code segments that access and update certain shared variables. Process X executes the P operation… Read More »

## Microsoft Interview | 16 3.5

I was interviewed for Microsoft App-Ex Team. I was selected. I am really thankful to GeeksForGeeks site which provides preparation material for technical interviews organised… Read More »

## C | Arrays | Question 9 3

Predict the output of the below program: filter_none edit close play_arrow link brightness_4 code #include <stdio.h> #define SIZE(arr) sizeof(arr) / sizeof(*arr); void fun(int* arr, int… Read More »

## C | Loops & Control Structure | Question 16 3

What is the output of the following program? filter_none edit close play_arrow link brightness_4 code #include <stdio.h> int main() {     char check = ‘a’;     switch… Read More »

## C | Loops & Control Structure | Question 15 3

In the following program, X represents the Data Type of the variable check. filter_none edit close play_arrow link brightness_4 code #include <stdio.h> int main() {… Read More »

## C++ | References | Question 6 3

Which of the following is FALSE about references in C++ (A) References cannot be NULL (B) A reference must be initialized when declared (C) Once… Read More »