Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
13 votes
5 answers
2k views

solve n*m matrix processing in less time

I want to solve a problem in less time complexity. Here are the details: Given an n*m matrix, n rows and m columns. Initially, the matrix is empty filled with 0s. ...
CodeCrusader's user avatar
3 votes
1 answer
187 views

Snail matrix in Java - version III (generalizing)

Once again, in the previous version, Alexander Ivanchenko helped me with his awesome answer. Now, I have improved the toString() and, also, generalized the class ...
coderodde's user avatar
  • 31.3k
5 votes
1 answer
341 views

Snail matrix in Java - version II

(This post is the continuation of Snail matrix in Java. Also, this post has an continuation.) As previously, a snail matrix is any square matrix \$M_n = \mathbb{N}^{n \times n}\$ with cell elements ...
coderodde's user avatar
  • 31.3k
6 votes
2 answers
915 views

Snail matrix in Java

(This post has an continuation: Snail matrix in Java - version II.) Inspired by this post, I decided to solve that problem in Java. The idea is to decide on an \$n \in \mathbb{N}\$, create a square ...
coderodde's user avatar
  • 31.3k
5 votes
2 answers
542 views

Generic matrix library in Java

I have this repository. The most important source files follow. com.github.coderodde.math.linear.matrix.AbstractMatrix.java: ...
coderodde's user avatar
  • 31.3k
2 votes
1 answer
109 views

Multidimensional array in Java

I have this multidimensional array that generalizes vectors and matrices: com.github.coderodde.util.MultidimensionalArray.java: ...
coderodde's user avatar
  • 31.3k
4 votes
3 answers
721 views

Immutable matrix class with mathematical methods

This was a homework assignment for a data structures course. The goal was to implement a given interface and the assignment was auto-graded by a system that ran some validation tests. Sadly I did not ...
Nifim's user avatar
  • 197
0 votes
1 answer
133 views

Given a matrix return true if it contains the Identity matrix (by recursion)

I need to write recursive static method with given 3 parameters the method will return true if the sub matrix with the size of (int size) which the left corner is mat[x][x] is the identity matrix ...
anton5450's user avatar
4 votes
4 answers
1k views

Make surrounding elements zero in a matrix, when you find a zero value

Please can you suggest a better / Optimized logic or code for the question. It has been asked that when you find a zero value in a matrix, make that element the sum of its upper, lower ,left, right ...
Aryaman 's user avatar
0 votes
1 answer
1k views

Find Passable Lanes in Rows and Columns

I have implemented the following question and looking forward for the reviews. Question Explanation : We have a two-dimensional board game involving snakes. The board has two types of squares on it: +...
Neslihan Bozer's user avatar
0 votes
2 answers
202 views

Given a 2d matrix with chars find the target string

I am looking for a simpler implementation of the following question. Could it get better? I am expecting the new solution via DFS again. Thanks. OA: Given a 2d matrix with chars and a target string. ...
Neslihan Bozer's user avatar
0 votes
1 answer
317 views

Iterating 2d array

I have implemented a MatrixIt class to traverse a 2D array. Is it possible to make the code clearer and shorter? ...
dankatle's user avatar
3 votes
2 answers
431 views

Array To Matrix

I made a method that takes an array and converts it to a matrix, given that it is a valid conversion. However, there is some redundant code in the beginning and I thought maybe you could help me? I ...
MoonReddit's user avatar
0 votes
2 answers
102 views

Better way to write this program in java?

I am new to writing java code and I would like to improve my skills. I would like someone to review and critic me on where I can improve on. Here is a small program I wrote in java about matrices and ...
Zeke's user avatar
  • 11
3 votes
1 answer
331 views

Finding shortest path in matrix

Given an N x N matrix of positive integers, I need to find the shortest path from the first cell of matrix to the last cell of matrix. I can move exactly x steps from any cell, where x is the value of ...
User3000's user avatar

15 30 50 per page
1
2 3 4 5
7