Company: hackerrank
Difficulty: medium
Mini-Markdown Renderer Problem Description You're building a tiny Markdown-to-HTML renderer for a note-taking app. Given a document as lines of text, convert it to HTML using the simplified rules below. Focus on correctness and clean handling of edge cases. Input A list of n lines ( 0 <= n <= 1000 ). Each line is UTF-8 text ( len <= 10^3 chars per line). Lines may be empty. Output A single string containing the HTML of the rendered document (only the fragment, no <html> or <body> tags). Rendering Rules 1. Headings Lines starting with # , ## , or ### become <h1> , <h2> , <h3> respectively. Only 1-3 leading # followed by one space count. Preserve internal spaces. Examples: # Title → <h1>Title</h1> ## Section Name → <h2>Section Name</h2> ### Subsection → <h3>Subsection</h3> 2. Paragraphs Any non-empty line that is not a heading becomes part of a paragraph. Consecutive lines are joined with a single s