Just a runnable solution
Code\n\nimpl Solution {\n    pub fn k_increasing(arr: Vec<i32>, k: i32) -> i32 {\n        pub fn upper_bound<T: Ord>(vec: &Vec<T>, x: &T) -> Result<usize, usize
# Code\n```\nimpl Solution {\n    pub fn k_increasing(arr: Vec<i32>, k: i32) -> i32 {\n        pub fn upper_bound<T: Ord>(vec: &Vec<T>, x: &T) -> Result<usize, usize> {\n            vec.iter().position(|y| y > x).ok_or(vec.len())\n        }\n\n        let mut longest = 0;\n        for i in 0..k {\n            let mut mono = vec![];\n            for j in (i..arr.len() as i32).step_by(k as usize) {\n                let j = j as usize;\n                if mono.is_empty() || mono.last().unwrap() <= &arr[j] {\n                    mono.push(arr[j]);\n                } else {\n                    let pos = upper_bound(&mono, &arr[j]).unwrap();\n                    mono[pos] = arr[j];\n                }\n            }\n            longest += mono.len();\n        }\n        arr.len() as i32 - longest as i32\n    }\n}\n```
['Rust']