You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use std::collections::VecDeque;structMinStack{stack:VecDeque<i32>,min_stack:VecDeque<i32>,}/** * `&self` means the method takes an immutable reference. * If you need a mutable reference, change it to `&mut self` instead. */implMinStack{/** initialize your data structure here. */fnnew() -> Self{Self{stack:VecDeque::new(),min_stack:VecDeque::new()}}fnpush(&mutself,x:i32){self.stack.push_back(x);ifself.min_stack.is_empty() || *self.min_stack.back().unwrap() >= x {self.min_stack.push_back(x);}}fnpop(&mutself){let val = self.stack.pop_back().unwrap();if*self.min_stack.back().unwrap() == val {self.min_stack.pop_back();}}fntop(&self) -> i32{*self.stack.back().unwrap()}fnget_min(&self) -> i32{*self.min_stack.back().unwrap()}}/** * Your MinStack object will be instantiated and called as such: * let obj = MinStack::new(); * obj.push(x); * obj.pop(); * let ret_3: i32 = obj.top(); * let ret_4: i32 = obj.get_min(); */
Output code
use std::collections::VecDeque;structMinStack{stack:VecDeque<i32>,min_stack:VecDeque<i32>,}/** * `&self` means the method takes an immutable reference. * If you need a mutable reference, change it to `&mut self` instead. */implMinStack{/** initialize your data structure here. */fnnew() -> Self{Self{stack:VecDeque::new(),min_stack:VecDeque::new()}}fnpush(&mutself,x:i32){self.stack.push_back(x);ifself.min_stack.is_empty() || *self.min_stack.back().unwrap() >= x {self.min_stack.push_back(x);}}fnpop(&mutself){let val = self.stack.pop_back().unwrap();if*self.min_stack.back().unwrap() == val {self.min_stack.pop_back();}}fntop(&self) -> i32{*self.stack.back().unwrap()}fnget_min(&self) -> i32{*self.min_stack.back().unwrap()}}/** * Your MinStack object will be instantiated and called as such: * let obj = MinStack::new(); * obj.push(x); * obj.pop(); * let ret_3: i32 = obj.top(); * let ret_4: i32 = obj.get_min(); */
Additional context
Hello, thank you for developing such a useful Prettier plugin. I encountered two issues while using it:
Commented code blocks are also being formatted.
This plugin seems to be unable to format code blocks in Markdown files with triple backticks for Rust (rust ). How should I handle this?
The text was updated successfully, but these errors were encountered:
Input code
Output code
Additional context
Hello, thank you for developing such a useful Prettier plugin. I encountered two issues while using it:
rust
). How should I handle this?The text was updated successfully, but these errors were encountered: