mirror of
https://github.com/krahets/hello-algo.git
synced 2026-04-02 02:02:57 +08:00
Refine some details and coding style for Rust codes (#344)
* Refine some details and coding style for Rust codes * Update coding style for Rust codes * Update time_complexity.rs * Update array.rs * Update leetcode_two_sum.rs * Update hash_map.rs * Update file headers * Update coding style for Rust codes and Zig codes * Update coding style for Rust codes and Zig codes --------- Co-authored-by: Yudong Jin <krahets@163.com>
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
/**
|
||||
/*
|
||||
* File: stack.rs
|
||||
* Created Time: 2023-02-05
|
||||
* Author: sjinzh (sjinzh@gmail.com)
|
||||
*/
|
||||
*/
|
||||
|
||||
include!("../include/include.rs");
|
||||
|
||||
/* Driver Code */
|
||||
pub fn main() {
|
||||
@@ -17,7 +19,7 @@ pub fn main() {
|
||||
stack.push(5);
|
||||
stack.push(4);
|
||||
print!("栈 stack = ");
|
||||
inc::print_util::print_array(&stack);
|
||||
print_util::print_array(&stack);
|
||||
|
||||
// 访问栈顶元素
|
||||
let peek = stack.get(stack.len() - 1).unwrap();
|
||||
@@ -26,7 +28,7 @@ pub fn main() {
|
||||
// 元素出栈
|
||||
let pop = stack.pop().unwrap();
|
||||
print!("\n出栈元素 pop = {pop},出栈后 stack = ");
|
||||
inc::print_util::print_array(&stack);
|
||||
print_util::print_array(&stack);
|
||||
|
||||
// 获取栈的长度
|
||||
let size = stack.len();
|
||||
|
||||
Reference in New Issue
Block a user