pub fn mostcommon(lines: Vec<String>, num: usize) -> char {
    let rows: usize = lines.len();
    let cols: usize = lines[0].len();
    
    let count: usize = lines.iter()
       .map(|line| line.chars())
       .flatten()
       .skip(num)
       .step_by(cols)
       .filter(|ch| *ch == '1')
       .count();

    if 2 * count >= rows {
        return '1';
    }
    '0'
}
// Find most common number in a column
Find most common number in a column
Find most common number in a column
pub fn mostcommon(lines: Vec<String>, num: usize) -> char {
    let rows: usize = lines.len();
    let cols: usize = lines[0].len();
    let count: usize = lines.iter()
       .map(|line| line.chars())
       .flatten()
       .skip(num)
       .step_by(cols)
       .filter(|ch| *ch == '1')
       .count();
    if 2 * count >= rows {
        return '1';
    }
    '0'
}
pub fn mostcommon ( lines : Vec < String > , num : usize ) -> char { let rows : usize = lines . len ( ) ; let cols : usize = lines [ 0 ] . len ( ) ; let count : usize = lines . iter ( ) . map ( | line | line . chars ( ) ) . flatten ( ) . skip ( num ) . step_by ( cols ) . filter ( | ch | * ch == '1' ) . count ( ) ; if 2 * count >= rows { return '1' ; } '0' }
Find most common number in a column
Find most common number in a column
lines
Vec<String>
num
usize
lines
Vec<String>
num
usize