0% found this document useful (0 votes)
6 views8 pages

Re Questions 3

The document discusses various problems related to recursion, including calculating binary strings without consecutive ones, printing patterns, and generating subsequences from a string. It also mentions additional problems like finding the next greater element and the stock span problem. The document emphasizes the importance of problem-solving skills and provides examples for practice.

Uploaded by

Luffy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views8 pages

Re Questions 3

The document discusses various problems related to recursion, including calculating binary strings without consecutive ones, printing patterns, and generating subsequences from a string. It also mentions additional problems like finding the next greater element and the stock span problem. The document emphasizes the importance of problem-solving skills and provides examples for practice.

Uploaded by

Luffy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Recursion

19 January 2025 10:04 AM

Recursion Page 1
Given a number x calculate the count of number of binary strings of length x which has no
Consecutive ones

Recursion Page 2
Tip for problem solving : try to form bunch of bunch of test cases

Recursion Page 3
Given a number nj print the follwing pattern solve using recursion

Recursion Page 4
q. Given a string 's' of alphabets write a function recursively that prints a new string which All
character of s except any occurance of 'x'
->

Abcxxadxacxe

Ans - > abcadace

Recursion Page 5
q. Given a string 'S', pring all possible subsequences o the string order of output doesn't matter

S = 'abc'
Ans
'abc'
'ab'
'ac'
'bc'
'a'
'b'
'c'
''

Recursion Page 6
Next greater element
Stock span problem -
Histogram
Sum of subarray minimum 907
Number of valid subarrays 1063

Learning dev you should be able to solve problems like ex


One iphone left in inventory and 2 people trying to buy same phone whom should we sell
Money deducted from user not reached our end

Recursion Page 7
Recursion Page 8

You might also like