Commit a226b084 authored by Kai Brandes's avatar Kai Brandes

small refactoring

parent 48b2f308
use std::iter::Iterator;
use std::iter::FromIterator;
use std::collections::HashSet;
use wasm_bindgen::prelude::*;
fn line_valid(input: &str) -> bool {
let mut whitespace: Vec<&str> = input.split_whitespace().collect();
let total_words = whitespace.len() as u32;
whitespace.sort();
whitespace.dedup_by(|a,b| a == b);
total_words == whitespace.len() as u32
total_words == whitespace.iter().collect::<HashSet<&&str>>().len() as u32
}
#[wasm_bindgen]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment