zig : update codes style && rust : add codes for chapter_backtracking. (#613)

* zig : update codes style

* rust : add codes for chapter_backtracking

* zig : update codes style
This commit is contained in:
sjinzh
2023-07-16 15:36:28 +08:00
committed by GitHub
parent 51a4c5089e
commit ead33ca863
17 changed files with 312 additions and 71 deletions
@@ -5,7 +5,7 @@
const std = @import("std");
// 带约束爬楼梯:动态规划
fn climbing_stairs_constraint_dp(comptime n: usize) i32 {
fn climbingStairsConstraintDP(comptime n: usize) i32 {
if (n == 1 or n == 2) {
return @intCast(n);
}
@@ -28,7 +28,7 @@ fn climbing_stairs_constraint_dp(comptime n: usize) i32 {
pub fn main() !void {
comptime var n: usize = 9;
var res = climbing_stairs_constraint_dp(n);
var res = climbingStairsConstraintDP(n);
std.debug.print("爬 {} 阶楼梯共有 {} 种方案\n", .{ n, res });
_ = try std.io.getStdIn().reader().readByte();