Question bank › Stack
Dsa Stack Easy

Matching HTML Tags

Write a program that checks if HTML tags in a given string are correctly nested and matched. You should only focus on the tags <b>, <i>, and <u>. If the tags are correctly nested and matched, return 'VALID'. If not, return 'INVALID'. Example: Input: '<b><i>Hello</i></b>', Output: 'VALID'.

Key concepts

stackparsingstring

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.