Write a component that parses a hardcoded HTML-like string and displays the tag hierarchy.
HardProblem Statement
Write a component that parses a hardcoded HTML-like string and displays the tag hierarchy.
Sample Input
String: '<div><p>Hello</p></div>'
Sample Output
Tag Hierarchy: ['div', 'p']
Limits
Time: 2s · Memory: 256 MB
Code Editor
Log in to submit00:00
Try your code in this preview. Submit marks it done.
import React from "react"; const ParseHTMLTags = () => { return ( <div> {/* Display the tag hierarchy */} </div> ); }; export default ParseHTMLTags;