Concise one-pass in-place solution with no recursion
With switch:\ncsharp\npublic int UniquePathsWithObstacles(int[][] g)\n{\n\tfor(int i = 0; i < g.Length; i++)\n\t{\n\t\tfor(int j = 0; j < g[0].Length; j++)\n\t\
With `switch`:\n```csharp\npublic int UniquePathsWithObstacles(int[][] g)\n{\n\tfor(int i = 0; i < g.Length; i++)\n\t{\n\t\tfor(int j = 0; j < g[0].Length; j++)\n\t\t{\n\t\t\tg[i][j] = (g[i][j], i, j) switch\n\t\t\t{\n\t\t\t\t\t(1, _, _) => 0,\n\t\t\t\t\t(_, 0, 0) => 1,\n\t\t\t\t\t(_, 0, _) => g[i][j - 1] * 1,\n\t\t\t\t\t(_, _, 0) => g[i - 1][j] * 1,\n\t\t\t\t\t_         => g[i - 1][j] + g[i][j - 1]\n\t\t\t};\n\t\t}\n\t}\n\treturn g[^1][^1];\n}\n```\n\nSame, rewritten with a classic `if-else`:\n```csharp\npublic int UniquePathsWithObstacles(int[][] g)\n{\n\tfor(int i = 0; i < g.Length; i++)\n\t{\n\t\tfor(int j = 0; j < g[0].Length; j++)\n\t\t{\n\t\t\tif(g[i][j] == 1)          g[i][j] = 0;\n\t\t\telse if(i == 0 && j == 0) g[i][j] = 1;\n\t\t\telse if(i == 0)           g[i][j] = g[i][j - 1] * 1;\n\t\t\telse if(j == 0)           g[i][j] = g[i - 1][j] * 1;\n\t\t\telse                      g[i][j] = g[i - 1][j] + g[i][j - 1];\n\t\t}\n\t}\n    return g[^1][^1];\n}\n```\n\nWhich version do you find more readable/maintainable?
['C#']