mirror of
				https://github.com/krahets/hello-algo.git
				synced 2025-11-04 14:18:20 +08:00 
			
		
		
		
	Make rust more idomatic (#1386)
This commit is contained in:
		@ -23,7 +23,7 @@ fn backtrack(mut state: Vec<i32>, choices: &[i32], selected: &mut [bool], res: &
 | 
				
			|||||||
            backtrack(state.clone(), choices, selected, res);
 | 
					            backtrack(state.clone(), choices, selected, res);
 | 
				
			||||||
            // 回退:撤销选择,恢复到之前的状态
 | 
					            // 回退:撤销选择,恢复到之前的状态
 | 
				
			||||||
            selected[i] = false;
 | 
					            selected[i] = false;
 | 
				
			||||||
            state.remove(state.len() - 1);
 | 
					            state.pop();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -27,7 +27,7 @@ fn backtrack(mut state: Vec<i32>, choices: &[i32], selected: &mut [bool], res: &
 | 
				
			|||||||
            backtrack(state.clone(), choices, selected, res);
 | 
					            backtrack(state.clone(), choices, selected, res);
 | 
				
			||||||
            // 回退:撤销选择,恢复到之前的状态
 | 
					            // 回退:撤销选择,恢复到之前的状态
 | 
				
			||||||
            selected[i] = false;
 | 
					            selected[i] = false;
 | 
				
			||||||
            state.remove(state.len() - 1);
 | 
					            state.pop();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user