diff --git a/GeeksForGeeks/May/25-5-24/GFG.java b/GeeksForGeeks/May/25-5-24/GFG.java new file mode 100644 index 0000000..c5992f7 --- /dev/null +++ b/GeeksForGeeks/May/25-5-24/GFG.java @@ -0,0 +1,43 @@ +//{ Driver Code Starts +import java.util.*; + +class GFG { + public static void main(String args[]) throws Exception { + Scanner sc = new Scanner(System.in); + int T = sc.nextInt(); + + while (T > 0) { + int N = sc.nextInt(); + int k = sc.nextInt(); + int ar[] = new int[N]; + // int count = 0; + for (int i = 0; i < N; i++) ar[i] = sc.nextInt(); + + System.out.println(new Solution().max_Books(ar, N, k)); + T--; + } + } +} +// } Driver Code Ends + + + +class Solution { + long max_Books(int arr[], int n, int k) { + // Your code here + long curr=0; + long max=0; + + for(int i=0;i ans=new ArrayList<>(); + + public List wordBreak(String s, List wordDict) + { + HashSet hs=new HashSet<>(); + for(String str:wordDict) + hs.add(str); + + findAns(0,s,hs,""); + return ans; + } + + public void findAns(int index,String s,HashSet hs,String temp) + { + if(index==s.length()) + { + ans.add(temp.substring(0,temp.length()-1)); + return; + } + + for(int i=index;i