You are playing the following Bulls and Cows game with your friend: You write down a number and ask your friend to guess what the number is. Each time your frie...
Given a 2D matrix matrix, find the sum of the elements inside the rectangle defined by its upper left corner (row1, col1) and lower right corner (row2, col2).