Back
Close

Fractal Tree

Statement
Given an integer, print the corresponding fractal tree. Fractals are self-similar drawing across different scales (recursive definition). learn more about fractals: https://en.wikipedia.org/wiki/Fractal for example to create a fractal tree, with n = 2, we start by drawing a vertical line | than we add two underscores to the upper part left and right: `__ __ |` than we add a fractal tree with n = 1 at the edges: `|_ _| |_ _| |__ __| |` in the end we add . to represent fruits... `. . . . |_ _| |_ _| |__ __| |`

Input description
Line 1: n

Output description
Print the corresponding fractal tree

Constraints
1 <= n <= 7

Game modes

Test cases
Test 1 Test
Input
1
Output
. . |_ _| |

Validator 1 Validator
Input
1
Output
. . |_ _| |

Test 2 Test
Input
2
Output
. . . . |_ _| |_ _| |__ __| |

Validator 2 Validator
Input
2
Output
. . . . |_ _| |_ _| |__ __| |

Test 3 Test
Input
3
Output
. . . . . . . . |_ _| |_ _| |_ _| |_ _| |__ __| |__ __| |_____ _____| |

Validator 3 Validator
Input
3
Output
. . . . . . . . |_ _| |_ _| |_ _| |_ _| |__ __| |__ __| |_____ _____| |

Test 4 Test
Input
4
Output
. . . . . . . . . . . . . . . . |_ _| |_ _| |_ _| |_ _| |_ _| |_ _| |_ _| |_ _| |__ __| |__ __| |__ __| |__ __| |_____ _____| |_____ _____| |___________ ___________| |

Validator 4 Validator
Input
4
Output
. . . . . . . . . . . . . . . . |_ _| |_ _| |_ _| |_ _| |_ _| |_ _| |_ _| |_ _| |__ __| |__ __| |__ __| |__ __| |_____ _____| |_____ _____| |___________ ___________| |

Test 5 Test
Input
5
Output
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |_ _| |_ _| |_ _| |_ _| |_ _| |_ _| |_ _| |_ _| |_ _| |_ _| |_ _| |_ _| |_ _| |_ _| |_ _| |_ _| |__ __| |__ __| |__ __| |__ __| |__ __| |__ __| |__ __| |__ __| |_____ _____| |_____ _____| |_____ _____| |_____ _____| |___________ ___________| |___________ ___________| |_______________________ _______________________| |

Validator 5 Validator
Input
5
Output
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |_ _| |_ _| |_ _| |_ _| |_ _| |_ _| |_ _| |_ _| |_ _| |_ _| |_ _| |_ _| |_ _| |_ _| |_ _| |_ _| |__ __| |__ __| |__ __| |__ __| |__ __| |__ __| |__ __| |__ __| |_____ _____| |_____ _____| |_____ _____| |_____ _____| |___________ ___________| |___________ ___________| |_______________________ _______________________| |

Solution language

Solution

Stub generator input