899. Orderly Queue Hard

@problem@discussion
#Math#String#Sorting



1/**
2 * [899] Orderly Queue
3 *
4 * You are given a string s and an integer k. You can choose one of the first k letters of s and append it at the end of the string..
5 * Return the lexicographically smallest string you could have after applying the mentioned step any number of moves.
6 *  
7 * Example 1:
8 * 
9 * Input: s = "cba", k = 1
10 * Output: "acb"
11 * Explanation: 
12 * In the first move, we move the 1^st character 'c' to the end, obtaining the string "bac".
13 * In the second move, we move the 1^st character 'b' to the end, obtaining the final result "acb".
14 * 
15 * Example 2:
16 * 
17 * Input: s = "baaca", k = 3
18 * Output: "aaabc"
19 * Explanation: 
20 * In the first move, we move the 1^st character 'b' to the end, obtaining the string "aacab".
21 * In the second move, we move the 3^rd character 'c' to the end, obtaining the final result "aaabc".
22 * 
23 *  
24 * Constraints:
25 * 
26 * 	1 <= k <= s.length <= 1000
27 * 	s consist of lowercase English letters.
28 * 
29 */
30pub struct Solution {}
31
32// problem: https://leetcode.com/problems/orderly-queue/
33// discuss: https://leetcode.com/problems/orderly-queue/discuss/?currentPage=1&orderBy=most_votes&query=
34
35// submission codes start here
36
37impl Solution {
38    pub fn orderly_queue(s: String, k: i32) -> String {
39        String::new()
40    }
41}
42
43// submission codes end
44
45#[cfg(test)]
46mod tests {
47    use super::*;
48
49    #[test]
50    fn test_899() {
51    }
52}
53


Back
© 2025 bowen.ge All Rights Reserved.