From c30ac6dec9302268afff95cfc5e9a956e4ee13f4 Mon Sep 17 00:00:00 2001 From: Ishi2702 <84222751+Ishi2702@users.noreply.github.com> Date: Sun, 24 Apr 2022 15:46:28 +0530 Subject: [PATCH 1/2] Create Problem Statement2 solution --- Problem Statement2 solution | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Problem Statement2 solution diff --git a/Problem Statement2 solution b/Problem Statement2 solution new file mode 100644 index 0000000..1c3ee7e --- /dev/null +++ b/Problem Statement2 solution @@ -0,0 +1,20 @@ +//solution2 +class Sol2 { + int total = 0; + //counting no. of vowel strings + public int count_vowel_strs(int n) { + helper(n, 0, 0); + return total; + } + + public void helper(int n, int curr_index, int curr_size) { + if (curr_size == n) { + total++; + return; + } + for (int i = curr_index; i < 5; i++) { + helper(n, i, ++curr_size); + curr_size --; + } + } +} From 707273bc5be66433466de5ade6f853d53a1debff Mon Sep 17 00:00:00 2001 From: Ishi2702 <84222751+Ishi2702@users.noreply.github.com> Date: Sun, 24 Apr 2022 15:48:40 +0530 Subject: [PATCH 2/2] Delete Problem Statement2 solution --- Problem Statement2 solution | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 Problem Statement2 solution diff --git a/Problem Statement2 solution b/Problem Statement2 solution deleted file mode 100644 index 1c3ee7e..0000000 --- a/Problem Statement2 solution +++ /dev/null @@ -1,20 +0,0 @@ -//solution2 -class Sol2 { - int total = 0; - //counting no. of vowel strings - public int count_vowel_strs(int n) { - helper(n, 0, 0); - return total; - } - - public void helper(int n, int curr_index, int curr_size) { - if (curr_size == n) { - total++; - return; - } - for (int i = curr_index; i < 5; i++) { - helper(n, i, ++curr_size); - curr_size --; - } - } -}