4

PROBLEM OF THE DAY : 13/12/2023 | Consecutive 1's not allowed

 9 months ago
source link: https://www.geeksforgeeks.org/videos/problem-of-the-day-12122023-consecutive-1s-not-allowed/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

PROBLEM OF THE DAY : 13/12/2023

December 14, 2023 |1.4K Views
PROBLEM OF THE DAY : 13/12/2023 | Consecutive 1's not allowed
Problem of the Day, dynamic-programming, Data Structure and Algorithm
 Save  Share  1 Like
Description
Discussion

Welcome to the daily solving of our PROBLEM OF THE DAY with Karan Mashru. We will discuss the entire problem step-by-step and work towards developing an optimized solution. This will not only help you brush up on your concepts of Array but also build up problem-solving skills.

In this problem, we are given, a positive integer N, and count all possible distinct binary strings of length N such that there are no consecutive 1’s. Output your answer modulo 109 + 7.

Example :

Input:
N = 3
Output: 5

Explanation:
5 strings are (000, 001, 010, 100, 101).

Give the problem a try before going through the video. All the best!!!
Problem Link: https://www.geeksforgeeks.org/problems/gold-mine-problem2608/1
Solution IDE Link: https://ide.geeksforgeeks.org/online-cpp-compiler/7ba73f83-80a2-4e7c-980c-bfe2a1e79790

Read More

Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK