(s: String, indices: Vec<i32>)
| 7 | // 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。 |
| 8 | |
| 9 | pub fn restore_string(s: String, indices: Vec<i32>) -> String { |
| 10 | let mut res: Vec<char> = vec!['c'; s.len()]; |
| 11 | for (i, c) in s.chars().enumerate() { |
| 12 | res[indices[i as usize] as usize] = c; |
| 13 | } |
| 14 | res.into_iter().collect() |
| 15 | } |
| 16 | |
| 17 | fn main() { |
| 18 | let s = "codeleet".to_string(); |
nothing calls this directly
no outgoing calls
no test coverage detected