Search⌘ K

DIY: Count a Word in the Comments

Explore how to identify comment sections in C++ source code lines and count the frequency of a given word within these comments. Develop skills to parse code effectively and implement a function that supports coding interview preparation.

We'll cover the following...

Problem statement

In this challenge, you are given two arguments: an array of strings containing lines of a C++ source code and a string containing a word. Your task is to identify which parts of the code are comments, and then count all occurrences of the input word present in the comments ...