From a96b65cbfad7f62f3db6b2eab105e4e25c0414c5 Mon Sep 17 00:00:00 2001 From: Jack Sangdahl Date: Fri, 27 Jun 2025 12:23:02 -0600 Subject: chore: remove old cpp and rust solutions --- other/kth_smallest_lexicographical.cpp | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 other/kth_smallest_lexicographical.cpp (limited to 'other/kth_smallest_lexicographical.cpp') diff --git a/other/kth_smallest_lexicographical.cpp b/other/kth_smallest_lexicographical.cpp deleted file mode 100644 index 71478e9..0000000 --- a/other/kth_smallest_lexicographical.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// 440. K-th Smallest in Lexicographical Order -#include "leetcode.h" -// given two integers 'n' and 'k', return the k'th lexicographically smallest -// integer - -class Soltuion { -public: - int findKthNumber(int n, int k) { - int curr = 1; - for (--k; k > 0;) { - int cnt = 0; - for (long long first = static_cast(curr), last = first + 1; - first <= n; first *= 10, last *= 10) - cnt += static_cast((min(n + 1LL, last) - first)); - if (k >= cnt) { - ++curr; - k -= cnt; - } else { - curr *= 10; - --k; - } - } - return curr; - } -}; - -int main() { - Soltuion obj; - printf("%d\n", obj.findKthNumber(13, 2)); // expect: 10 - printf("%d\n", obj.findKthNumber(1, 1)); // expect: 1 -} -- cgit v1.2.3