## Practice Questions for Recursion | Set 1

Explain the functionality of following functions. Question 1 filter_none edit close play_arrow link brightness_4 code int fun1(int x, int y) { if(x == 0) return… Read More »

- How can one become good at Data structures and Algorithms easily?
- Cracking Technical Interviews
- Print the nodes of binary tree as they become the leaf node
- Reach the numbers by making jumps of two given lengths
- Dijkstra's shortest path with minimum edges
- Shannon-Fano Algorithm for Data Compression
- Rearrange Odd and Even values in Alternate Fashion in Ascending Order
- How to write a Pseudo Code?
- Sort the array of strings according to alphabetical order defined by another string
- Longest subsequence such that adjacent elements have at least one common digit
- Code Optimization Technique (logical AND and logical OR)
- Iterative Letter Combinations of a Phone Number
- Check if it is possible to reach a number by making jumps of two given length
- Sum of similarities of string with all of its suffixes
- Dividing a Large file into Separate Modules in C/C++, Java and Python
- Smallest Pair Sum in an array
- Merge K sorted arrays | Set 3 ( Using Divide and Conquer Approach )
- Find the number in a range having maximum product of the digits
- Ternary Search
- Count pairs in array whose sum is divisible by K
- Length of the longest alternating subarray
- Smallest power of 2 which is greater than or equal to sum of array elements
- Largest perfect square number in an Array
- Travelling Salesman Problem implementation using BackTracking
- Count common characters in two strings
- Count distinct substrings that contain some characters at most k times
- Number of array elements derivable from D after performing certain operations
- Find alphabet in a Matrix which has maximum number of stars around it
- Array Manipulation and Sum
- Choose atleast two elements from array such that their GCD is 1 and cost is minimum

Explain the functionality of following functions. Question 1 filter_none edit close play_arrow link brightness_4 code int fun1(int x, int y) { if(x == 0) return… Read More »

Given a sorted array and a value x, the ceiling of x is the smallest element in array greater than or equal to x, and… Read More »

You can win three kinds of basketball points, 1 point, 2 points, and 3 points. Given a total score n, print out all the combination… Read More »

Write a program to reverse a stack using recursion. You are not allowed to use loop constructs like while, for..etc, and you can only use… Read More »

Assume the structure of a Linked List node is as follows. filter_none edit close play_arrow link brightness_4 code struct Node { int data; struct Node… Read More »

Given a binary matrix, find out the maximum size square sub-matrix with all 1s. For example, consider the below binary matrix. Recommended: Please solve it… Read More »

Given an integer n, find whether it is a power of 4 or not. Example : Input : 16 Output : 16 is a power… Read More »

By making use of recursion, we can multiply two integers with the given constraints. To multiply x and y, recursively add x y times. C++… Read More »

Question: Write an efficient program for printing k largest elements in an array. Elements in array can be in any order. For example, if given… Read More »

You are given an array of 0s and 1s in random order. Segregate 0s on left side and 1s on right side of the array.… Read More »

We need not to do anything if a number is positive. We want to change only negative numbers. Since negative numbers are stored in 2’s… Read More »

Write a C function to return minimum and maximum in an array. You program should make minimum number of comparisons. Recommended: Please solve it on… Read More »

Question: Write a C function to find if a given integer x appears more than n/2 times in a sorted array of n integers. Basically,… Read More »

Write an efficient C program to find smallest and second smallest element in an array. Example: Input: arr[] = {12, 13, 1, 10, 34, 1}… Read More »

Question: An Array of integers is given, both +ve and -ve. You need to find the two elements such that their sum is closest to… Read More »