Micro Focus QTP (UFT) Forums
Find the number of occurrences of each number present in a matrix. - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Interview Questions (https://www.learnqtp.com/forums/Forum-UFT-QTP-Interview-Questions)
+--- Thread: Find the number of occurrences of each number present in a matrix. (/Thread-Find-the-number-of-occurrences-of-each-number-present-in-a-matrix)



Find the number of occurrences of each number present in a matrix. - Kalai - 12-22-2014

Can someone please give me the solution for below general programming question,

How to print the number of occurrences of each number presnt in a matrix.

For examble:

x =

22 23 23 23

23 24 25 22

22 23 23 25


for the above matrix, it should print like below,

Code:
"Number 22 occurred 3 time"
"Number 23 occurred 6 time"
"Number 24 occurred 1 time"
"Number 25 occurred 2 time"



RE: Find the number of occurrences of each number present in a matrix. - supputuri - 12-24-2014

matrix is an array?


RE: Find the number of occurrences of each number present in a matrix. - gauravarora6611 - 03-30-2015

Yes it is a 2d array...