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/restore_array.cpp | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 other/restore_array.cpp (limited to 'other/restore_array.cpp') diff --git a/other/restore_array.cpp b/other/restore_array.cpp deleted file mode 100644 index 4f4a59a..0000000 --- a/other/restore_array.cpp +++ /dev/null @@ -1,37 +0,0 @@ -// 1416. Restore The Array -#include "leetcode.h" - -/* - * a progamme was supposed to print an array of integers. the programme forgot - * to print whitespace and the array is printing as a string of digits 's' and - * all we know is that all integers in the array were in the range [1, k] and - * there are no leading zeros in the array. given the string 's' and the integer - * 'k', return the number of possible arrays that can be printed as 's' using - * the mentioned programme. return modulo 10^9+7 - */ - -class Solution { -public: - int numberOfArrays(string s, int k) { - vector dp(s.size() + 1); - dp[s.size()] = 1; - for (int i = s.size() - 1; i >= 0; --i) { - if (s[i] == '0') - continue; - for (long sz = 1, n = 0; i + sz <= s.size(); ++sz) { - n = n * 10 + s[i + sz - 1] - '0'; - if (n > k) - break; - dp[i] = (dp[i] + dp[i + sz]) % 1000000007; - } - } - return dp[0]; - } -}; - -int main() { - Solution obj; - printf("%d\n", obj.numberOfArrays("1000", 10000)); // expect: 1 - printf("%d\n", obj.numberOfArrays("1000", 10)); // expect: 0 - printf("%d\n", obj.numberOfArrays("1317", 2000)); // expect: 8 -} -- cgit v1.2.3