Quote:I searched everywhere but could only find maximum number in whole matrix or maximum number in each row and column
Development isn't about searching the internet and giving up when you can't find exactly what you need: if it was, nothing new could even be produced and that would be very silly.
Instead, it's about thinking: read the task carefully, think about what is required, break it down into smaller bits and see if you can do them. If you can do a smaller step, do. If you can't break it down into smaller bits and try to do them. Repeat as necessary.
This is your homework, not ours: and it doesn't help anyone in the long run for us to do it for you - especially you! If you can't do this - pretty trivial - task for yourself, then the next task (which will be more complicated because your tutor assumes you understood this one) is going to be even further beyond you. And when you finally get to the exams, and can't get help at all ... well, you know what happens then.
So stop, throw the code you found away, and think about the task: it's not really at all complicated and if you think about how you would do it manually, that should tell you how to do it on a computer.
Give it try: see how far you can get.