2022 Developer Survey is open! Take survey.

New answers tagged

1 vote
Accepted

Returning all divisors of a number as a matrix with N X 2 dimensions

PEP8 specifies CapWords for class names. But you should figure out a better class name than DataStructure, since that's not very descriptive. Your docstring starts out "from any input". ...
user avatar
  • 674
0 votes
Accepted

Validator for 0/1 entries in a matrix

You already know the primary problem with your code: repetition. You have written reasonable code that is not difficult to understand. The problem is that you have four nearly identical chunks of code....
user avatar
  • 9,615
1 vote

Validator for 0/1 entries in a matrix

Your operation is pretty strange and has lots of edge cases so there's a limited amount that you can do to shorten your code. But you should probably use Numpy to handle matrix operations. ...
user avatar
  • 47.9k
3 votes
Accepted

С++: Find max element from section in matrix

Create a class Matrix Instead of passing around vectors of vectors, consider creating a class Matrix. That makes the code much ...
user avatar
  • 32.6k

Top 50 recent answers are included