Skip to main content

All Questions

Filter by
Sorted by
Tagged with
3 votes
1 answer
412 views

Find number of ways to traverse matrix of 0's and 1's

I solved a Daily Coding Challenge, but i suspect my code could be optimised. The challenge is the following: You are given an N by M matrix of 0s and 1s. Starting from the top left corner, how many ...
John Doe's user avatar
4 votes
0 answers
150 views

LeetCode 1632: Rank Transform of a Matrix in Rust

This is a problem-solving code for LeetCode 1632. Given an \$m \times n\$ matrix, return a new matrix answer where ...
prehistoricpenguin's user avatar
1 vote
1 answer
232 views

Exercism: Class representation of a matrix in Python

The task is to represent a Matrix as a class and to instantiate it from a string such as "1 2 3 4\n5 6 7 8\n9 8 7 6" The class must provide methods for ...
Konstantin Kostanzhoglo's user avatar
2 votes
1 answer
78 views

R solution to max product in matrix for four adjacent numbers (Euler 11)

Background This is solution to Problem 11 on Project Euler that is concerned with finding largest product of four adjacent numbers in the provided grid. Other than solving the problem I was also ...
Konrad's user avatar
  • 313
3 votes
1 answer
523 views

Using Python to search a sorted 2D Matrix

Code Problem ...
matta's user avatar
  • 31
1 vote
1 answer
1k views

Rotate matrix clockWise and counter clockWise

This code is a mix of the same question one time rotating to the right and one time to the left. I tried to simplify the code since I'm struggling with all of the indexing here. https://leetcode.com/...
Gilad's user avatar
  • 5,443
3 votes
1 answer
205 views

LeetCode: Transpose Matrix C#

Please review performance https://leetcode.com/problems/transpose-matrix/ Given a matrix A, return the transpose of A. The transpose of a matrix is the matrix flipped over it's main diagonal, ...
Gilad's user avatar
  • 5,443
2 votes
1 answer
482 views

GeeksforGeeks: Rotate matrix by 90 degrees

Please review the code readability, I would like to have an easier to follow code. Thanks ...
Gilad's user avatar
  • 5,443
1 vote
2 answers
461 views

JavaScript Spiral Matrix Coding Challenge

A whiteboarding challenge: Given a 2D array (matrix) inputMatrix of integers, create a function spiralCopy that copies ...
MadHatter's user avatar
  • 865
12 votes
4 answers
16k views

Python 3 function to rotate an image 90°

A coding challenge that rotates an image 90 degrees counterclockwise. The image is represented as an array matrix. I believe the time complexity is O(n2), but I'd like to know for sure, as well as any ...
MadHatter's user avatar
  • 865
8 votes
1 answer
2k views

Codewars: N-dimensional Von Neumann Neighborhood in a matrix

Task: For creating this challenge on Codewars I need a very performant function that calculates Von Neumann Neighborhood in a N-dimensional array. This function will be called about 2000 times The ...
Superluminal's user avatar
3 votes
2 answers
4k views

Print concentric rectangular patterns

I am solving interview questions from here. Problem : Print concentric rectangular pattern in a 2d matrix. The outermost rectangle is formed by A, then the next outermost is formed by A-1 and so on. ...
Latika Agarwal's user avatar
1 vote
3 answers
2k views

Calculate median of a matrix

I am solving interview questions from here. Problem : Given a N cross M matrix in which each row is sorted, find the overall median of the matrix. Assume N*M is odd. Note: No extra memory is ...
Latika Agarwal's user avatar
3 votes
1 answer
201 views

Project Euler Problem 11 in Rust: largest product of consecutive elements of 20x20 grid

Here is my solution to problem 11 on Project Euler. The goal was to find the largest product of any four numbers in consecutive line of any direction (vertical, horizontal, or diagonal). While my ...
stevensonmt's user avatar
2 votes
2 answers
2k views

HackerRank - Queens Attack II - Java

The problem definition can already be found here. Given a chess board with dimensions n × n (where n is up to 100000) and the (r, c) positions of various obstacles, how many squares can a queen at a ...
Koray Tugay's user avatar
  • 1,587

15 30 50 per page