{"id":"3b10a027-3525-42b3-a9ba-60524b1b83b5","name":"Arrange Buildings","description":"1. You are given a number n, which represents the length of a road. The road has n plots on it's each side.\r\n2. The road is to be so planned that there should not be consecutive buildings on either side of the road.\r\n3. You are required to find and print the number of ways in which the buildings can be built on both side of roads.","inputFormat":"A number n","outputFormat":"A number representing the number of ways in which the buildings can be built on both side of roads.","constraints":"0 &lt; n &lt;= 45","sampleCode":{"cpp":{"code":"#include<iostream>\r\nusing namespace std;\r\nint main() {\r\n\r\n}"},"java":{"code":"import java.io.*;\r\nimport java.util.*;\r\n\r\npublic class Main{\r\n\r\npublic static void main(String[] args) throws Exception {\r\n // write your code here\r\n }\r\n\r\n}"},"python":{"code":"# write here"}},"points":10,"difficulty":"easy","sampleInput":"6","sampleOutput":"441","questionVideo":"https://www.youtube.com/embed/0nF-BMYy7tc?end=167","hints":[],"associated":[{"id":"6c72f7c8-13a1-40c5-b6ed-e1aaf9974407","name":"What will be the output if the input is 4?","slug":"what-will-be-the-output-if-the-input-is-4","type":4},{"id":"a5182361-bcd2-4834-963b-fcc2584013ad","name":"If we use recursion what will be the base condition?","slug":"if-we-use-recursion-what-will-be-the-base-condition","type":4},{"id":"c0455778-c49c-4165-8e78-6fe96d70dc4a","name":"Can we use recursion to solve the problem.","slug":"can-we-use-recursion-to-solve-the-problem","type":4}],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"52d62581-1313-45fb-aaf0-1d72a45f6a50","name":"Dynamic Programming And Greedy For Beginners","slug":"dynamic-programming-and-greedy-for-beginners","type":0},{"id":"2882bf78-67a0-45b2-b878-0b98db09a09f","name":"Arrange Buildings","slug":"arrange-buildings","type":1}],"next":{"id":"974bb76f-ae90-4a6b-98af-bc53d3efc274","name":"Arrange Buildings","type":3,"slug":"arrange-buildings"},"prev":{"id":"80c99904-3ac6-4d42-97f3-d71a3979889d","name":"Count Binary Strings","type":3,"slug":"count-binary-strings"}}}

Arrange Buildings

1. You are given a number n, which represents the length of a road. The road has n plots on it's each side. 2. The road is to be so planned that there should not be consecutive buildings on either side of the road. 3. You are required to find and print the number of ways in which the buildings can be built on both side of roads.

{"id":"3b10a027-3525-42b3-a9ba-60524b1b83b5","name":"Arrange Buildings","description":"1. You are given a number n, which represents the length of a road. The road has n plots on it's each side.\r\n2. The road is to be so planned that there should not be consecutive buildings on either side of the road.\r\n3. You are required to find and print the number of ways in which the buildings can be built on both side of roads.","inputFormat":"A number n","outputFormat":"A number representing the number of ways in which the buildings can be built on both side of roads.","constraints":"0 &lt; n &lt;= 45","sampleCode":{"cpp":{"code":"#include<iostream>\r\nusing namespace std;\r\nint main() {\r\n\r\n}"},"java":{"code":"import java.io.*;\r\nimport java.util.*;\r\n\r\npublic class Main{\r\n\r\npublic static void main(String[] args) throws Exception {\r\n // write your code here\r\n }\r\n\r\n}"},"python":{"code":"# write here"}},"points":10,"difficulty":"easy","sampleInput":"6","sampleOutput":"441","questionVideo":"https://www.youtube.com/embed/0nF-BMYy7tc?end=167","hints":[],"associated":[{"id":"6c72f7c8-13a1-40c5-b6ed-e1aaf9974407","name":"What will be the output if the input is 4?","slug":"what-will-be-the-output-if-the-input-is-4","type":4},{"id":"a5182361-bcd2-4834-963b-fcc2584013ad","name":"If we use recursion what will be the base condition?","slug":"if-we-use-recursion-what-will-be-the-base-condition","type":4},{"id":"c0455778-c49c-4165-8e78-6fe96d70dc4a","name":"Can we use recursion to solve the problem.","slug":"can-we-use-recursion-to-solve-the-problem","type":4}],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"52d62581-1313-45fb-aaf0-1d72a45f6a50","name":"Dynamic Programming And Greedy For Beginners","slug":"dynamic-programming-and-greedy-for-beginners","type":0},{"id":"2882bf78-67a0-45b2-b878-0b98db09a09f","name":"Arrange Buildings","slug":"arrange-buildings","type":1}],"next":{"id":"974bb76f-ae90-4a6b-98af-bc53d3efc274","name":"Arrange Buildings","type":3,"slug":"arrange-buildings"},"prev":{"id":"80c99904-3ac6-4d42-97f3-d71a3979889d","name":"Count Binary Strings","type":3,"slug":"count-binary-strings"}}}
plane

Editor


Loading...

Arrange Buildings

easy

1. You are given a number n, which represents the length of a road. The road has n plots on it's each side. 2. The road is to be so planned that there should not be consecutive buildings on either side of the road. 3. You are required to find and print the number of ways in which the buildings can be built on both side of roads.

Constraints

0 < n <= 45

Format

Input

A number n

Output

A number representing the number of ways in which the buildings can be built on both side of roads.

Example

Sample Input

6

Sample Output

441

Question Video

Discussions

Show Discussion

Related Resources

related resources

Turning Off Zen Mode