Skip to content

Instantly share code, notes, and snippets.

Sasha alex-rogachev

Block or report user

Report or block alex-rogachev

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@alex-rogachev
alex-rogachev / solution.rb
Last active Feb 28, 2019
Minimum grid path solution
View solution.rb
# Given a m x n grid filled with non-negative numbers, find a path from top left
# to bottom right which minimizes the sum of all numbers along its path.
def minimum_path_sum(grid)
m, n = detect_grid_size(grid)
validate_grid!(grid, n)
# Prepare table that contains path cost
path_cost = Array.new(m) { Array.new(n) { 0 } }
You can’t perform that action at this time.