## Print Fibonacci sequence using 2 variables

Print the Fibonacci sequence. The first Fibonacci numbers are: Output: 0 1 1 2 3 5 8 13 21 34 How to print using 2… Read More »

Print the Fibonacci sequence. The first Fibonacci numbers are: Output: 0 1 1 2 3 5 8 13 21 34 How to print using 2… Read More »

Given a 3 x n board, find the number of ways to fill it with 2 x 1 dominoes. Example 1 Following are all the… Read More »

Given n wines in a row, with integers denoting the cost of each wine respectively. Each year you can sale the first or the last… Read More »

Consider a tree with n nodes and root. You can jump from one node to any other node on the same height a maximum of… Read More »

Given n elements, write a program that prints the longest increasing subsequence whose adjacent element difference is one. Examples: Input : a[] = {3, 10,… Read More »

Given N elements, write a program that prints the length of the longest increasing subsequence whose adjacent element difference is one. Examples: Input : a[]… Read More »

Given an array arr[]. Determine whether it is possible to split the array into two sets such that the sum of elements in both the… Read More »

Given an array, we partition a row of numbers A into at most K adjacent (non-empty) groups, then the score is the sum of the… Read More »

Given an array of n positive integers, write a program to find the maximum sum of increasing subsequence from prefix till i-th index and also… Read More »

Given n arrays of different length consisting of integers, task is to find the maximum sum of elements in that 2D array of size m… Read More »

Given a matrix (or 2D array) a[][] of integers, find prefix sum matrix for it. Let prefix sum matrix be psa[][]. The value of psa[i][j]… Read More »

Given a text and a wildcard pattern, find if wildcard pattern is matched with text. The matching should cover the entire text (not partial text).… Read More »

Given an array of integers, a number and a maximum value, task is to compute the maximum value that can be obtained from the array… Read More »

A Multistage graph is a directed graph in which the nodes can be divided into a set of stages such that all edges are from… Read More »

Given an integer ‘n’, print the first ‘n’ terms of the Moser-de Bruijn Sequence. The Moser-de Bruijn sequence is the sequence obtained by adding up… Read More »