Skip to content

Instantly share code, notes, and snippets.

@kcore
Created June 22, 2021 08:19
Show Gist options
  • Save kcore/b19fe9741dd2ae8b4266ecb9d590a897 to your computer and use it in GitHub Desktop.
Save kcore/b19fe9741dd2ae8b4266ecb9d590a897 to your computer and use it in GitHub Desktop.
Build a Rails API that accepts input which is a N x M matrix containing only 1 & 0 as elements, return a sub-matrix of maximum size with all 1s.
For example, consider the below matrix.
matrix = [
[1, 0, 1, 1],
[0, 1, 0, 1],
[1, 1, 1, 0],
[1, 1, 1, 1]
]
The submatix with only 1's & maximum size is
[
[1,1,1],
[1,1,1]
]
Expectations:
- Ensure that there is code documentation, test cases
- Please deploy the API on Heruko & share the endpoint
- Share the github repository URL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment