diff --git a/GeeksForGeeks/February/1-2-24/GFG.java b/GeeksForGeeks/February/1-2-24/GFG.java new file mode 100644 index 0000000..dc4168a --- /dev/null +++ b/GeeksForGeeks/February/1-2-24/GFG.java @@ -0,0 +1,53 @@ +//{ Driver Code Starts +//Initial template for JAVA + +import java.lang.*; +import java.io.*; +import java.util.*; + + +// } Driver Code Ends +//User function template for JAVA + +class Solution +{ + //Function to check if a string is Pangram or not. + public static boolean checkPangram (String str) + { + // your code here + Set set = new HashSet<>(); + + for (char ch : str.toCharArray()) + { + if (ch >= 'a' && ch <= 'z') + set.add(ch); + + if (ch >= 'A' && ch <= 'Z') + { + ch = Character.toLowerCase(ch); + set.add(ch); + } + } + + return set.size() == 26; + } +} + +//{ Driver Code Starts. + +class GFG + { + public static void main (String[] args) throws IOException + { + BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); + int t=Integer.parseInt(br.readLine()); + while(t-->0) + { + String s=br.readLine().trim(); + + System.out.println(new Solution().checkPangram (s)==true?1:0); + } + + } +} +// } Driver Code Ends diff --git a/GeeksForGeeks/February/1-2-24/README.md b/GeeksForGeeks/February/1-2-24/README.md new file mode 100644 index 0000000..ba09c45 --- /dev/null +++ b/GeeksForGeeks/February/1-2-24/README.md @@ -0,0 +1,2 @@ +Time complexity - O(logn) +Space complexity - O(1) diff --git a/LeetCode/February/1-2-24/README.md b/LeetCode/February/1-2-24/README.md new file mode 100644 index 0000000..fe18828 --- /dev/null +++ b/LeetCode/February/1-2-24/README.md @@ -0,0 +1,2 @@ +Time complexity - O(nlogn) or O(sort) +Space complexity - O(n) diff --git a/LeetCode/February/1-2-24/Solution.java b/LeetCode/February/1-2-24/Solution.java new file mode 100644 index 0000000..11c6d5b --- /dev/null +++ b/LeetCode/February/1-2-24/Solution.java @@ -0,0 +1,19 @@ +class Solution +{ + public int[][] divideArray(int[] nums, int k) + { + int[][] ans = new int[nums.length / 3][3]; + + Arrays.sort(nums); + + for (int i = 2; i < nums.length; i += 3) + { + if (nums[i] - nums[i - 2] > k) + return new int[0][]; + + ans[i / 3] = new int[] {nums[i - 2], nums[i - 1], nums[i]}; + } + + return ans; + } +}