Squash questions and ids
(ps: &mut Vec<Problem>, ids: Vec<String>)
| 81 | |
| 82 | /// Squash questions and ids |
| 83 | pub fn squash(ps: &mut Vec<Problem>, ids: Vec<String>) -> crate::Result<()> { |
| 84 | use std::collections::HashMap; |
| 85 | |
| 86 | let mut map: HashMap<String, bool> = HashMap::new(); |
| 87 | ids.iter().for_each(|x| { |
| 88 | map.insert(x.to_string(), true).unwrap_or_default(); |
| 89 | }); |
| 90 | |
| 91 | ps.retain(|x| map.contains_key(&x.id.to_string())); |
| 92 | Ok(()) |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | pub fn superscript(n: u8) -> String { |