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/combinations.cpp | 39 --------------------------------------- 1 file changed, 39 deletions(-) delete mode 100644 other/combinations.cpp (limited to 'other/combinations.cpp') diff --git a/other/combinations.cpp b/other/combinations.cpp deleted file mode 100644 index 94d4bfc..0000000 --- a/other/combinations.cpp +++ /dev/null @@ -1,39 +0,0 @@ -// 77. Combinations -#include "leetcode.h" - -/* - * given two integers 'n' and 'k', return all possible combinations of 'k' - * numbers chosen from the range '[1, n]'. you may return the answer in any - * order - */ - -class Solution { -public: - vvd combine(int n, int k) { - vvd ans; - int i = 0; - vector p(k, 0); - while (i >= 0) { - p[i]++; - if (p[i] > n) - --i; - else if (i == k - 1) - ans.push_back(p); - else - i++, p[i] = p[i - 1]; - } - return ans; - } -}; - -int main() { - Solution obj; - for (auto i : obj.combine(4, 2)) - for (auto j : i) - printf("%d ", j); // expect: [[1,2],[1,3],[1,4],[2,3],[2,4],[3,4]] - printf("\n"); - for (auto i : obj.combine(1, 1)) - for (auto j : i) - printf("%d ", j); // expect: [[1]] - printf("\n"); -} -- cgit v1.2.3