Design an algorithm to solve the following problem: Given a NxN matrix, find the smallest positive integer missing from it.
user
A possible algorithm to solve the problem is as follows: 
1. Initialize a result variable (res) to -1.
2. Iterate over the given matrix.
3. For each element, check if it is greater than 0.
4. If so, store it in a set s.
5. For each element in the matrix, iterate from 1 to N and if the element is not present in the set, update the result variable (res) with the value and break from the loop.
6. Finally, return res.
assistant