mirror of
https://github.com/krahets/hello-algo.git
synced 2025-07-07 15:01:58 +08:00
refactor: add/refactor method in include, simplified print code (#471)
This commit is contained in:
@ -75,7 +75,7 @@ public class array_stack
|
||||
stack.push(2);
|
||||
stack.push(5);
|
||||
stack.push(4);
|
||||
Console.WriteLine("栈 stack = " + String.Join(",", stack.toArray()));
|
||||
Console.WriteLine("栈 stack = " + string.Join(",", stack.toArray()));
|
||||
|
||||
/* 访问栈顶元素 */
|
||||
int peek = stack.peek();
|
||||
@ -83,7 +83,7 @@ public class array_stack
|
||||
|
||||
/* 元素出栈 */
|
||||
int pop = stack.pop();
|
||||
Console.WriteLine("出栈元素 pop = " + pop + ",出栈后 stack = " + String.Join(",", stack.toArray()));
|
||||
Console.WriteLine("出栈元素 pop = " + pop + ",出栈后 stack = " + string.Join(",", stack.toArray()));
|
||||
|
||||
/* 获取栈的长度 */
|
||||
int size = stack.size();
|
||||
|
Reference in New Issue
Block a user