Category Archives: Programs

Printing Hollow pattern in CPP

Given N = no of rows and M = no of columns, print the hollow pattern. ********** * * * * * * ********** Given above is an example of hollow pattern of 5 x 10. Given below is the approach to built hollow pattern: To iterate through rows, run an outer loop from 1 to rows. Define… Read More »

Balanced Brackets Problem in Data Structures in C++

Write a program to validate whether the brackets in the given input string are balanced or not. Examples: Input : {[()]} Output : Valid Input :{{(}}[] Output : Invalid Explanation: This problem is a very common application of stacks in data structures. An opening bracket may be ‘{‘,'[‘,'(‘ and their corresponding closing brackets are ‘}’,’]’,’)’. The brackets are… Read More »

Why choose switch case in C++

In this technological and digital age where everything is automated. We should prefer something which saves time and space and makes our work easy. Lucky for us C++ programmers, we have switch case statements. It is a great alternative to the If else condition statement. It reduces the amount of code to a very small size which saves… Read More »