heyimShivam / Algorithm

C++ algorithm in one place, This is dedicated repository for maintaining data structures and algorithm code. This repository will be helpful for students preparing for internships or campus placements. Topics
10 stars 71 forks source link

count of number of string #187

Closed Shaina-08 closed 1 year ago

Shaina-08 commented 1 year ago

To count all occurrences, we follow simple brute force approach. Traverse through each character of the matrix and taking each character as a start of the string to be found. Try to search in all the possible directions. Whenever, a word is found, increase the count. After traversing the matrix what ever will be the value of count will be number of times string exists in character matrix.