maze

package
v0.0.0-...-8d3c4b6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 20, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CherryPickUp

func CherryPickUp(grid [][]int) int

Wrong Solution Greedy DP not working this is a two-leg dp, one leg greedy did not mean the global optimization for example

grid = [[1,1,1,0,1],
      [0,0,0,0,0],
      [0,0,0,0,0],
      [0,0,0,0,0],
      [1,0,1,1,1]].
 greedy solution: from (0,0) -> (n-1, n-1) is 6, from (n-1,n-1) -> (0,0) is 1 so the total is 7.
 The expected solution is follow the edges,
 (0,0) -> (n-1, n-1) is 5
 (n-1,n-1) -> (0,0) is 3, so the total is 8

func CherryPickUpNew

func CherryPickUpNew(grid [][]int) int

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL