If you are not sure if the website you would like to visit is secure, you can verify it here. Enter the website address of the page and see parts of its content and the thumbnail images on this site. None (if any) dangerous scripts on the referenced page will be executed. Additionally, if the selected site contains subpages, you can verify it (review) in batches containing 5 pages.
favicon.ico: leetcodejavascript.com/solutions/tag-validator - #591 - Tag Validator - LeetCod.

site address: leetcodejavascript.com/solutions/tag-validator redirected to: leetcodejavascript.com/solutions/tag-validator

site title: #591 - Tag Validator - LeetCode JavaScript Solutions

Our opinion (on Thursday 19 November 2026 13:36:10 UTC):

GREEN status (no comments) - no comments

Meta tags:
description=Given a string representing a code snippet, implement a tag validator to parse the code and return whether it is valid. A code snippet is va...;
keywords=leetcode, javascript, solutions, algorithms, data structures, coding, programming, coding challenges, coding problems, coding solutions;
author=;

Headings (most frequently used words):

591, tag, validator, problem, description, solution,

Text of the page (most frequently used words):
the (23), tag (18), code (16), and (12), valid (11), tag_name (11), return (9), stack (7), const (6), false (6), cdata (6), characters (6), length (5), invalid (5), unmatched (5), closed (5), cdata_content (4), validator (4), has (4), you (4), start (4), end (4), tags (4), tag_content (4), string (3), indexof (3), else (3), contain (3), should (3), following (3), subsequent (3), all (3), otherwise (3), leetcodejavascript (2), com (2), function (2), startswith (2), slice (2), test (2), may (2), any (2), parse (2), parsed (2), format (2), range (2), find (2), when (2), not (2), necessarily (2), with (2), same (2), are (2), only (2), snippet (2), view (2), github (2), leetcode (2), 591 (2), solutions (2), 2025, josh, crozier, param, boolean, var, isvalid, for, let, pop, push, solution, forbid, even, some, that, can, matter, treat, regular, defined, between, first, cannot, until, next, exists, vice, versa, however, also, need, consider, issue, unbalanced, nested, other, see, note1, except, upper, case, letters, exactly, among, them, must, wrapped, rules, hold, given, representing, implement, whether, problem, description, hard, back, star, javascript,


Text of the page (random words):
591 tag validator leetcode javascript solutions leetcodejavascript com star on github back to all solutions 591 tag validator hard view on leetcode view on github string stack problem description given a string representing a code snippet implement a tag validator to parse the code and return whether it is valid a code snippet is valid if all the following rules hold the code must be wrapped in a valid closed tag otherwise the code is invalid a closed tag not necessarily valid has exactly the following format tag_name tag_content tag_name among them tag_name is the start tag and tag_name is the end tag the tag_name in start and end tags should be the same a closed tag is valid if and only if the tag_name and tag_content are valid a valid tag_name only contain upper case letters and has length in range 1 9 otherwise the tag_name is invalid a valid tag_content may contain other valid closed tags cdata and any characters see note1 except unmatched unmatched start and end tag and unmatched or closed tags with invalid tag_name otherwise the tag_content is invalid a start tag is unmatched if no end tag exists with the same tag_name and vice versa however you also need to consider the issue of unbalanced when tags are nested a is unmatched if you cannot find a subsequent and when you find a or all the subsequent characters until the next should be parsed as tag_name not necessarily valid the cdata has the following format cdata cdata_content the range of cdata_content is defined as the characters between cdata and the first subsequent cdata_content may contain any characters the function of cdata is to forbid the validator to parse cdata_content so even it has some characters that can be parsed as tag no matter valid or invalid you should treat it as regular characters solution param string code return boolean var isvalid function code const stack for let i 0 i code length if i 0 stack length return false if code startswith cdata i const j i 9 i code indexof j if i 1 return false i 3 else if code startswith i const j i 2 i code indexof j if i 1 return false const tag code slice j i if stack length stack pop tag a z 1 9 test tag return false i else if code i const j i 1 i code indexof j if i 1 return false const tag code slice j i if a z 1 9 test tag return false stack push tag i else i return stack length 2025 leetcodejavascript com josh crozier
Thumbnail images (randomly selected): * Images may be subject to copyright.GREEN status (no comments)

    No Images


    Verified site has: 3 subpage(s). Do you want to verify them? Verify pages:

    1-3


    The site also has 3 references to external domain(s).

     github.com  Verify  leetcode.com  Verify  joshcrozier.com  Verify


    The site also has 1 references to other resources (not html/xhtml )

     github.com/JoshCrozier/leetcode-javascr___.js  Verify


    Top 50 hastags from of all verified websites.

    Supplementary Information (add-on for SEO geeks)*- See more on header.verify-www.com

    Header

    HTTP/1.1 301 Moved Permanently
    Date Thu, 19 Nov 2026 13:36:10 GMT
    Content-Type text/html; charset=UTF-8
    Transfer-Encoding chunked
    Connection close
    Location htt????/leetcodejavascript.com/solutions/tag-validator
    Report-To group : cf-nel , max_age :604800, endpoints :[ url : htt????/a.nel.cloudflare.com/report/v4?s=ZLGxDJLw3f5iAH57O1uMqbjafEq9p8IShstMbWt8jFr5FnhCuSFzHbfbZLJXejGa9BrwJuzHgocfFeYz06g3Nsx9Cn99MP53GsEJ7e2pVhM5FanH1X0KpDlpD9zLdv71Y54kXLzQUwZ7 ]
    Nel report_to : cf-nel , success_fraction :0.0, max_age :604800
    Server cloudflare
    CF-RAY a5cf9a337ad4f3b3-CDG
    alt-svc h3= :443 ; ma=86400
    HTTP/2 200
    date Thu, 19 Nov 2026 13:36:10 GMT
    content-type text/html; charset=utf-8
    x-frame-options DENY
    report-to group : cf-nel , max_age :604800, endpoints :[ url : htt????/a.nel.cloudflare.com/report/v4?s=dLCEnOiQ23B8dYDTeuSUD4VBIxYjfhtipMgp7uv2okqXbn6FdZ5R6MjjWq9ihIWdwn%2BWnthT%2FJqNYnzLRp7GXdTltY2VC1GUvDKlAYHZUH9%2FMYNZ%2FfYJnbjWKvAMmk3rtHFvPdi9BtAh ]
    nel report_to : cf-nel , success_fraction :0.0, max_age :604800
    access-control-allow-origin htt????/leetcodejavascript.com
    cache-control public, max-age=14400, must-revalidate
    x-content-type-options nosniff
    strict-transport-security max-age=31536000
    permissions-policy geolocation=(), microphone=(), camera=(), payment=(), usb=(), accelerometer=(), gyroscope=(), magnetometer=()
    referrer-policy no-referrer
    vary accept-encoding
    server cloudflare
    last-modified Thu, 19 Nov 2026 13:36:10 GMT
    cf-cache-status MISS
    content-encoding gzip
    cf-ray a5cf9a33dee399d3-AMS
    alt-svc h3= :443 ; ma=86400

    Meta Tags

    title="#591 - Tag Validator - LeetCode JavaScript Solutions"
    charset="UTF-8"
    name="viewport" content="width=device-width, initial-scale=1.0"
    name="description" content="Given a string representing a code snippet, implement a tag validator to parse the code and return whether it is valid. A code snippet is va..."
    name="keywords" content="leetcode, javascript, solutions, algorithms, data structures, coding, programming, coding challenges, coding problems, coding solutions"
    name="author" content="LeetCodeJavascript.com"
    name="robots" content="index, follow"
    property="og:type" content="article"
    property="og:url" content="htt????/leetcodejavascript.com/solutions/tag-validator"
    property="og:title" content="#591 - Tag Validator - LeetCode JavaScript Solutions"
    property="og:description" content="Given a string representing a code snippet, implement a tag validator to parse the code and return whether it is valid. A code snippet is va..."
    property="og:image" content="htt????/leetcodejavascript.com/og-image.jpg"
    property="og:site_name" content="LeetCode JavaScript Solutions"
    name="twitter:card" content="summary_large_image"
    name="twitter:url" content="htt????/leetcodejavascript.com/solutions/tag-validator"
    name="twitter:title" content="#591 - Tag Validator - LeetCode JavaScript Solutions"
    name="twitter:description" content="Given a string representing a code snippet, implement a tag validator to parse the code and return whether it is valid. A code snippet is va..."
    name="twitter:image" content="htt????/leetcodejavascript.com/og-image.jpg"
    name="twitter:creator" content="@joshcrozier"
    name="theme-color" content="#1f2937"

    Load Info

    page size3430
    load time (s)0.215797
    redirect count1
    speed download15953
    server IP 188.114.96.2
    * all occurrences of the string "http://" have been changed to "htt???/"