question_id
int64
700k
876k
question_title
stringlengths
3
81
question_content
stringlengths
131
2.51k
dataset
stringclasses
1 value
difficulty
stringclasses
3 values
java
dict
python
dict
test_cases
stringlengths
200
208M
706,119
Triplets with sum with given range
Given an array Arr[]of N distinct integers and a range from Lto R, the task is to count the number of triplets having a sum in the range [L, R]. Examples: Input: N = 4 Arr = {8 , 3, 5, 2} L = 7, R = 11 Output: 1 Explanation: There is only one triplet {2, 3, 5} having sum 10 in range [7, 11]. Input: N = 5 Arr = {5, 1...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "static int countTriplets(int Arr[], int N, int L, int R)" ], "initial_code": "// Initial Template for Java\n\nimport java.io.*;\nimport java.util.*;\n\nclass GFG {\n public static void main(String args[]) throws IOException...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "countTriplets(self, Arr, N, L, R)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n t = int(input())\n for _ in range(t):\n N = int(input())\n Arr = input().split()\n ...
eJy9VUuOU0EMZMGGW1hvPYPabrs/nASJIBaQBZswi4w0EgJxCFiz45yU3Yk0A+lMBj0RyU9R4ld2lcvd357/+PXiWXxe/8SXN5+Xj7ub2/3yihbe7Dh5pES9d0QjJqFMSkaF6mYn/l/GY7miZXt3s32/33549+l2f4Tom93XzW75ckUPgVu866+SIgxREBXRvFzywv4rtym46AScDYE2jSp1YibOxEZciTsJKGQSI6kkaC+jxrREbm1SQ4YywE3kTMQGm2yDkdpgZTaYFRvsqg2GzYIldYv6/jBAip0XtNQZZ/EgUcqFtKEmVaGm1Aug...
703,348
Split Strings
Given a string S which consists of alphabets , numbers and special characters. You need to write a program to split the strings in three different strings S1, S2 and S3 such that the string S1 will contain all the alphabets present in S , the string S2 will contain all the numbers present in S and S3 will contain all s...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "static List<String> splitString(String S)" ], "initial_code": "//Initial Template for Java\n\nimport java.io.*;\nimport java.util.*; \n\nclass GFG{\n public static void main(String args[]) throws IOException { \n Sca...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "splitString(ob, S)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n T = int(input())\n for _ in range(T):\n S = input()\n ob = Solution()\n ans = ob.splitString(S)...
eJy1Vl1v0lAY9sIrfwUt2wJjaAu0gIsJjOE2Y3RjEvdxGBlQRsWdFihfQ4jX3pno//VpSytVDrYyuCLk+XrPefqWr09/fn/2xPpcfMOX6wmvUr1v8C9DvEhovlYXE0kuFz5UmilJ3tq+OWqp6Ux2ZzfC74V4ZaQrdUNpVLW+MSeBASxQhIIJDtCEQgFcsAidEcpP90Jen6vxSMhmqrH4xXCQlqUXXyZlo5dKJqaEXJc6uihkK/sMQ1BBAhw4QqECPpigEApBSJkilX2GM5KdDZWScYm0iNg/0U4RGkkfrkYFZI9WYwxjm2YSTOjyccFm...
700,360
Sum of subset differences
Given a sorted array arr consisting of integers, find the sum of the difference between the last and the first element of each non-empty subset of arr. Examples: Input: arr = [5,8] Output: 3 Explanation: There are 3 non-empty subsets possible for the given array S = [5, 8] : Subset: [5] (The first and last eleme...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "long sumDiff(int arr[])" ], "initial_code": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int t = Integer.parseInt(scanner...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "sumDiff(self, arr)" ], "initial_code": "def main():\n T = int(input()) # Read the number of test cases\n\n while T > 0:\n a = list(map(\n int,\n input().strip().split())) # Convert input to...
eJy1lM9KxEAMxj2IzxF6XiXJdJqpTyJY8aB78FL3sAuCf/Ah9H1NYlcEO9kqWMrM0nZ+8+XLt/N6/P50cuTXxU5/XD42d+Nmt23OoUnDSECoNw5jRpCsEzBCnp41K2jWD5v1zXZ9e32/207ruJdhfBlGzj7JNDfPK/hGZ6Wj0RJCa0z9EqgFJuACKUPL1R2E0ZHUosyxydhodDQ+2g5oewSqhf3trNBOC1alVPSD3mdgUXJXx/k7MwFllkpmqWrqbBAbig29DaY9sBepopQ+GxYt7vWqLmVI0EKGDgQK9N57BTJQss5QBuqAtEsFqAeu...
702,772
Find the element that appears once in sorted array
Given a sorted array arr[] of size N. Find the element that appears only once in the array. All other elements appear exactly twice. Examples: Input: N = 11 arr[] = {1, 1, 2, 2, 3, 3, 4, 50, 50, 65, 65} Output: 4 Explanation: 4 is the only element that appears exactly once.
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1619079291, "func_sign": [ "int findOnce(int arr[], int n)" ], "initial_code": "//Initial Template for Java\n\nimport java.util.*;\n\npublic class GFG \n{\n public static void main(String args[]) \n {\n Scanner sc = new Scanner(System.in);\n...
{ "class_name": "Solution", "created_at_timestamp": 1619079291, "func_sign": [ "findOnce(self,arr : list, n : int)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n t = int(input())\n\n for _ in range(t):\n n = int(input())\n arr = [int(x) for x in in...
eJzF1MFKxDAQBmAP4nMMPS+SZCZJ65MIVjzoHrzEPXRBEMWH0Cf15snJr1WQnbJ2C26+QNkynUw6zfPx6/vJEX7nb3px8dDcls12aM6o8X3xrJM8BR2sQyjqSDoy5b40K2rW95v19bC+ubrbDl+B0pcnvfm4ol9PizodVR4CMHmBCAmyMhPUZe3O0PUlOKo8BGAQChESZGihU2a2YNUTdLKjykMABoFInCBDC10lTpk5OVo5tXTxVAVgEIiQIJO00FXRgYeg7JeXrb3tS2dvUr21M0zXq71CE5F2YKSWWjPQ2iL9X8ZONYOTEazVj62O...
704,439
Minimum number of Coins
Given an infinite supply of each denomination of Indian currency{ 1, 2, 5, 10, 20, 50, 100, 200, 500, 2000 } and a target value N. Find the minimum number of coins and/or notes needed to make the change for Rs N. You must return the list containing the valueof coins required. Examples: Input: N = 43 Output: 20 20 2 1 ...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "static List<Integer> minPartition(int N)" ], "initial_code": "// Initial Template for Java\n\nimport java.io.*;\nimport java.util.*;\n\nclass GFG{\n public static void main(String args[])throws IOException\n {\n B...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "minPartition(self, N)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n t = int(input())\n for _ in range(t):\n N = int(input())\n\n ob = Solution()\n arr = ob.minP...
eJzt3U9Po0AYB2AP+0EIZzVAi1Y/ySaL8bD24KV6aBMTo/G8593vuzBtdWxEpf7LmGdanrYJJwL0x8zLcPfj3/jPTmg/99ovv67z89nlYp4fZ3nZzI5Ca2b5bpZPry6nv+fTs9OLxXy1RlUURQYAAIBUqKOlWi1199G966xqX83stk1/N7vZRi6cHB7UY7kQAAAgFeLkVxbL1Nef9urxqCoLaQ8APo74arws+s7HVWjOx3gHsq67p29PK0Ozp72eOFW1R3DZt2W7/rORYxgAgK9nczCsCv/hveloEpr/cAAAkCQPnY7rEqByWQLU24Ex...
706,235
Search insert position of K in a sorted array
Given a sorted arrayArr[](0-index based)consisting ofNdistinct integers and an integer k, the task is to find the index of k, if its present in the array Arr[]. Otherwise, find the index where kmust be inserted to keep the array sorted. Examples: Input: N = 4 Arr = {1, 3, 5, 6} k = 5 Output: 2 Explanation: Since 5 i...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "static int searchInsertK(int Arr[], int N, int k)" ], "initial_code": "//Initial Template for Java\n\nimport java.io.*;\nimport java.util.*;\n\nclass GFG{\n public static void main(String args[])throws IOException\n {\n ...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "searchInsertK(self, Arr, N, k)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n t = int(input())\n for _ in range(t):\n N = int(input())\n Arr = input().split()\n ...
eJzFVLFOwzAQZUDiNyzPDfI5cePwJUgEMUAGltAhlZBQKzY2Jvhf/M6uSyWuJBBEh1N9vrv38t4lz6fvr2cn/Lt8CX+unvR9v1oP+kJpansybV+QMUYVDsEiUDwqo0LAAVcoCrW1M3qhdPe46m6H7u7mYT3sp23bXm8W6ncQMkIzE4I03800n2sFDDMTxhEISSa7h2gQPEKNsMywFUJ5QCAi44h8lVigBb0Y0nyzGeW/EGpEPlYy4RMhn2lUO/CIWSUsn6xQhCwhTciTj+RCwIXFhcWF9eybE32jozpFNVyWxGVdXBbHfbUzyDITFwVD...
705,637
Broken blocks
In the game of Broken Blocks, the player is allowed to move on m x nblocks i.e. mlevels and nstone blocks on each level such that one level is vertically above the previous level (as in a staircase), with some of its stone blocks replaced by wooden blocks. The player at the start of the game is present on the ground le...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "public int MaxGold(int[][] matrix)" ], "initial_code": "//Initial Template for Java\n\nimport java.util.*;\nimport java.lang.*;\nimport java.io.*;\nclass GFG\n{\n public static void main(String[] args) throws IOException\n ...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "MaxGold(self, matrix)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n T = int(input())\n for i in range(T):\n m, n = input().split()\n m = int(m)\n n = int(n)\n ...
eJzlVktuE0EQZcEFuEHL6xhNVbv8QWLHIZAwYgFZsBmycCQkBOIQcF966j+O2pgoUQJkk/FMdderV68+35/+fPXsCf+9ftke3nxZfByvrg+LF2UB+5EK7UcYyhIKDgWoPezH9qO9QpK3+7EOhZ/Zzj63k+0fH5bzVGr7ubgoi8vPV5fvD5cf3n26PqirXXPzrX39elHmANZlPaFwCHw5+6AJjuFgEGLBLwW12LMtyqHKaOwTx6d31+mmLj7AHsBV2ShARUcTIo1cwzZk+9FIFBvxa9iZNCS17AEZhg6QTanNJ0VkerlQRJIXIQLJeGTz...
702,994
Count of camel case characters
Given a string. Count the number of Camel Case characters in it. Examples: Input: S = "ckjkUUYII" Output: 5 Explanation: Camel Case characters present: U, U, Y, I and I. Input: S = "abcd" Output: 0 Explanation: No Camel Case character present.
geeksforgeeks
Easy
{ "class_name": "Sol", "created_at_timestamp": 1615292571, "func_sign": [ "int countCamelCase(String s)" ], "initial_code": "//Initial Template for Java\n\nimport java.io.*;\nimport java.util.*;\nclass GfG\n{\n public static void main (String[] args)\n {\n \n Scanner sc = new Scanner(S...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "countCamelCase(self,s)" ], "initial_code": "# Initial Template for Python 3\n\nt = int(input())\nfor tc in range(t):\n s = input()\n ob = Solution()\n print(ob.countCamelCase(s))\n print(\"~\")\n# Contributed By: P...
eJxrYJm6io0BDCIWAxnR1UqZeQWlJUpWCkqGMXlVxIMoCoCSjoJSakVBanJJakp8fmkJ1AFmBjF5dTF5SrU6CqjOcnRydnF1c/fw9PL28fXzDwgMCg4JDQuPiIyMikpMSk5JTUvPyMzKzsnNyy8oLCouKS0rr6iswmGLkQUOW3CZBLIlKjIiPCw0JDgoMMDfz9fH28vTw93N1cXZyRGHLca4/GJoZGxiamZuYWmg6KCsohqnpqWhGa9dU1sdo2Rlb2ejo6dvHRODw1Cc4YNDvSEO9bgiAJd6XxLV55Lo/kQS1eOKWhLC3JDiQMdiqCmG...
703,489
Compatible friends
Given two arrays arr1 and arr2. Return the count of i such that arr1[i]!=arr2[i] Examples: Input: arr1[] = [3, 1, 2, 4, 5] and arr2[] = [3, 2, 4, 1, 5] Output: 2 Explanation: Compatibility difference is two because first ranks movie 1 before 2 and 4 but other ranks it after. Input: arr1[] = [5, 3, 1, 2, 4] and arr2[]...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "public int findDifference(int[] arr1, int[] arr2)" ], "initial_code": "// Initial Template for Java\n\nimport java.io.*;\nimport java.lang.*;\nimport java.util.*;\n\nclass Main {\n public static void main(String args[]) thr...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "findDifference(self, arr1, arr2)" ], "initial_code": "# Initial Template for Python 3\nimport io\nimport sys\n\n# Contributed by : Nagendra Jha\n\nif __name__ == '__main__':\n test_cases = int(input())\n\n for cases in r...
eJztVk2PEzEM5cCRH/E05xWqJ+M44ZcgUcQBeuBS9tCVkBCrvXDjCP8Xf6SrBpRd2lIkJFxFb5omz88eu/Ld0+9fnz1xe/lFH159mt5vr2920wtMtN7SChUFggzGgoQZtquQ9CvrtujPFbSarjBtPl5v3u427958uNntOVbr7e16O32+wk/MTqak6+0984CDRxQrN1S3gBIgATlACQK7XeluWAxuAxF5LAKzrqRr0cW6si7RVUycLmP+/ZMDAeNEPvCJdzVcA1cycNUSVdwgbshuYDd9mW773Xam3Yj7A6fLKD4GJZCAMkgP0eJPbfdi...
701,292
Subarray range with given sum
Given an unsorted array of integers arr[], and a target tar, determine the number of subarrays whose elements sum up to the target value. Examples: Input: arr[] = [10, 2, -2, -20, 10] , tar = -10 Output: 3 Explanation: Subarrays with sum -10 are: [10, 2, -2, -20], [2, -2, -20, 10] and [-20, 10]. Input: arr[] = [1, 4...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1616127453, "func_sign": [ "static int subArraySum(int arr[], int tar)" ], "initial_code": "// Initial Template for Java\nimport java.io.*;\nimport java.lang.*;\nimport java.util.*;\n\n//Position this line where user code will be pasted.\n\nclass GFG {\n...
{ "class_name": "Solution", "created_at_timestamp": 1616127453, "func_sign": [ "subArraySum(self,arr, tar)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == \"__main__\":\n t = int(input())\n while t > 0:\n arr = list(map(int, input().split()))\n tar = int(input())...
eJxrYJl6goUBDCIOAhnR1UqZeQWlJUpWCkqGMXkgpKSjoJRaUZCaXJKaEp9fWoKQrYvJU6rVUUDVYgBEJGrRBWMSNRkagACMJtlGqG5dsrSDNCmQQsTkmeK2xQyXLQq6hgpYCNwBbGSKK1IUMCBuU0xxmaJrqoAbAaWNcJlojsNAUwUMCAopUmIDv8XYYh5fYjMgzedEeN0Eq6Nx2Y+mDk8kYVEJSmhgt5qSEqq4cpYhgayFNajQnKFLtEeJU6ZramSEP7pjp+gBACETYbs=
703,481
Next higher palindromic number using the same set of digits
Given a palindromic number N in the form of string. The task is to find the smallest palindromic number greater than N using the same set of digits as in N. Examples: Input: N = " 35453" Output: 53435 Explanation: Next higher palindromic number is 53435. Input: N = "33" Output: -1 Explanation: Next higher palind...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1618226666, "func_sign": [ "public String nextPalin(String N)" ], "initial_code": "//Initial Template for Java\n\nimport java.io.*;\nimport java.util.*;\n\nclass GfG\n{\n public static void main(String args[])\n {\n Scanner sc = new Scanner(...
{ "class_name": "Solution", "created_at_timestamp": 1618226666, "func_sign": [ "nextPalin(self,N)" ], "initial_code": "if __name__ == '__main__':\n t = int(input())\n\n for _ in range(t):\n s = input()\n\n solObj = Solution()\n\n print(solObj.nextPalin(s))\n print(\"~\")\...
eJyVk8EKwjAMhj3sQUbPU5o0ZZtv4W3gxIP24KXusMFAFB9C39e26A5CCsmpkH7Nn+Tvs3h3xSpFtwuH/U1d/DCNalsq6D2Aqkrl5sGdRnc+Xqfxm1uH5KP36l6VfwQa5CAEA8hwbQxpMUuGrFxhRiCrD7TW4mG0TV034q4olNIkbitScolhgGQYiIw1lOFYjKdYKDMN+SgwmDCz5GhRds95GDDaB9nKAOl5ng/5dCmnXe5O+zMAyL/D4jixd/g2F+Tw2nwAddVTOQ==
705,888
Print Diagonally
Give a N * N square matrix A, return all the elements of its anti-diagonals from top to bottom. Examples: Input: N = 2 A = [[1, 2], [3, 4]] Output: 1 2 3 4 Explanation: Hence, elements will be returned in the order {1, 2, 3, 4}. Input: N = 3 A = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] Output: 1 2 4 3 5...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "static ArrayList<Integer> downwardDiagonal(int N, int A[][])" ], "initial_code": "//Initial Template for Java\n\nimport java.io.*;\nimport java.util.*;\nclass GFG\n{\n public static void main(String args[])throws IOExceptio...
{ "class_name": null, "created_at_timestamp": 1615292571, "func_sign": [ "downwardDiagonal(N, A)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n t = int(input())\n for _ in range(t):\n n = int(input())\n matrix = []\n for i in range(n):\n ...
eJzFVMtOwzAQ5NAL4idGOVco6zzLlyARxAFy4BJ6SCUkBOIj4H+ZOImbCtYODRVJJdvZ3ZnxdnffV58X52f2uV5xc/MSPTbbXRtdIZKq4S81VROtEdXP2/q+rR/unnbt4JAaVM0bza9rHMalVRPDvt6NgjvY1VchTag3ts9I444953BUeSfRmAQfnBRuJilDd3Ho6aIDaNcgMsqnNaEPtzkKlNiQl58FYiAJJIV0bjmkgJSQDQzthnEGJoEhfKZfj+g58RnaCSktaI6sY0k6ROJIbEnKDlAyS0DYuEfWlItLfDC1evpGD4f07UMAWlvD...
702,679
Complement
You are given a binary string str. In a single operation, you can choose two indices L and R such that 1 ≤ L ≤ R ≤ N and complement the characters between L and R i.e strL, strL+1, , strR. By complement, we mean change character 0 to 1 and vice-versa. Examples: Input: N = 3 str = "111" Output: -1 Explanation: As all...
geeksforgeeks
Medium
{ "class_name": "Solve", "created_at_timestamp": 1615292571, "func_sign": [ "Vector<Integer> findRange(String str, int n)" ], "initial_code": "// Initial Template for Java\n\nimport java.io.*;\nimport java.util.*;\n\nclass GFG {\n // Driver code\n public static void main(String[] args) throws Except...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "findRange(self,a, size)" ], "initial_code": "if __name__ == '__main__':\n tc = int(input())\n while tc > 0:\n n = int(input())\n s = input()\n ob = Solution()\n ans = ob.findRange(s, n)\n ...
eJytlM8KgkAQxjvUewx7tpgRtehJgjaCyoOXzYNCEEEPUe/brrqStqNsOILsYX77ffNHn/N3tphVsTvpw/4uMpWXhdiCIKliqciECECktzw9F+nleC2LJmOpU8QjgC4UaQgJGSaE0AUlUmEVDEaQuLBNZRCR9xhB7AIJDYk1y4kmsP5huVxOwoZXC0O07TAxegmB0WIcoH38BmLYFh0Q5lgpiaREGu4wM51m7/Srb8Svj/VWKe+10kL1Hnd6+H2fNdTm9Ood3S2HYZyqcnR4MmfPKXh1ofsxNvqq1v9zZiM775yc/WP5aQ5XOuXAD6/V...
706,338
Longest Increasing Path in a Matrix
Given a matrix with n rows and m columns. Your task is to find the length of the longest increasing path in matrix, here increasing path means that the value in the specified path increases. For example if a path of length k has values a1, a2, a3, .... ak , then for every i from [2,k] this condition must hold ai> ai-1....
geeksforgeeks
Hard
{ "class_name": "Solution", "created_at_timestamp": 1616696075, "func_sign": [ "int longestIncreasingPath(int matrix[][], int n, int m)" ], "initial_code": "// Initial Template for Java\n\nimport java.util.*;\n\nclass GFG {\n public static void main(String args[]) {\n Scanner sc = new Scanner(Sy...
{ "class_name": "Solution", "created_at_timestamp": 1616696075, "func_sign": [ "longestIncreasingPath(matrix, n, m)" ], "initial_code": "# Initial Template for Python 3\n# Position this line where user code will be pasted.\n\n# Your code goes here\nif __name__ == '__main__':\n t = int(input())\n for...
eJztmE2OHUUQhFlwB7apWVuoM7P+mpMgMYgFeMFmYGFLSAjEIeCW7LgAX1TXe57BaozNIGzLXth+csyrrvwioqr9y8e//fHJR/PX57/zly9+vPn27vvnz24+sxu/vfPNfNMfm+277cP2bnuzvdpebE/bw3a3fbOx2xg2uo1mo9ooNtJG2HAbm/Xd+rDerTfr1XqxntbDulvfrO3WhrVurVmr1oq1tBbW3Npmdbc6rHarzWq1Wqym1bDqVjcru5VhpVtpVqqVYiWthBW3slnulsOyWzbLalks0zIs3XKz2C2GRbdoFtWiWKRFWLgF+97N...
714,220
Smaller Sum
You are given an array arr of n integers. For each index i, you have to find the sum of all integers present in the array with a value less than arr[i]. Examples: Input: n = 3 arr = {1, 2, 3} Output: 0 1 3 Explanation: For 1, there are no elements lesser than itself. For 2, only 1 is lesser than 2. And for 3, 1 and ...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1678707676, "func_sign": [ "public long[] smallerSum(int n,int arr[])" ], "initial_code": "//Initial Template for Java\nimport java.util.*;\nimport java.io.*;\n\npublic class GFG\n{\n public static void main(String args[])throws IOException\n {\n ...
{ "class_name": "Solution", "created_at_timestamp": 1678707676, "func_sign": [ "smallerSum(self, n : int, arr : List[int]) -> List[int]" ], "initial_code": "class IntArray:\n def __init__(self) -> None:\n pass\n\n def Input(self, n):\n arr = [int(i) for i in input().strip().split()] #...
eJy9VEFOhEAQ9GB8R2fOG9PNMAP4EhMxHpSDF9zDbmJi1vgI/YI3/2gNMIF17WHRKDChE7qrmuqaeTl9+zg76a7LdwRXT+a+XW835oKM1C0eNisyzeO6ud00dzcP283wlalun+vW7FZ0UCMcr6XFDoQ03GptvHUMYcqYLFPO5HQg6XJ8CFJojnKylJEoQIDxSBC9JWEsIFggOSQXVFIFVr0zpPrQnzjKUFmS9ZS7JD4DsgS0p7mGAQQ4gAIaBPP92+lMoWiMMpeec+EOMpMkY9bIcYSZxrKRUCHx3Z/AHWH0wR8dFTyQckmf64dmIFkS...
703,404
Maximum difference of zeros and ones in binary string
Given a binary string Sconsisting of 0s and 1s. The task is to find the maximum difference of the number of 0s and the number of 1s (number of 0s – number of 1s) in thesubstrings of a string. Examples: Input: S = "11000010001" Output: 6 Explanatio: From index 2 to index 9, there are 7 0s and 1 1s, so number of 0...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "int maxSubstring(String S)" ], "initial_code": "//Initial Template for Java\n\nimport java.io.*;\nimport java.util.*;\n\nclass GFG {\n public static void main(String args[]) throws IOException {\n BufferedReader read...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "maxSubstring(self, S)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n T = int(input())\n for i in range(T):\n s = input()\n\n ob = Solution()\n answer = ob.maxSub...
eJxrYJlqwcYABhGGQEZ0tVJmXkFpiZKVgpJhTJ4BMlDSUVBKrShITS5JTYnPLy2BKTOOyVOq1VFA1WkIAvi0mWLTZUBrgMMxluZYXYPLx1g9jEOxLlbVeNxigis4SbPAEAZJ8gRcG0m6IDGN24lYvQS3CqcTjWiaRPCahcNF5ljTOnWsJBHQJLfgij+caZigVkPscU+cXtqWEfjNIikFIBmEUvaBuDEgEQybcHnZAFdWISc3Q92BMzcTlZpx2WgG0hw7RQ8AJICgSg==
700,333
Find Maximum value
Given an array arr[] you have to find the maximum value of abs(i – j) *min(arr[i], arr[j]) where i and j vary from 0 to n-1 and i != j. Examples: Input: arr[] = [3, 2, 1, 4] Output: 9 Explanation: Here, a[0] = 3 and a[3] = 4 and thus result is abs(0-3)*min(3,4) = 9. Input: arr[] = [8, 1, 9, 4] Output: 16 Explanati...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1619259086, "func_sign": [ "public int maxValue(int[] arr)" ], "initial_code": "import java.util.ArrayList;\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n ...
{ "class_name": "Solution", "created_at_timestamp": 1619259086, "func_sign": [ "maxValue(self, arr)" ], "initial_code": "if __name__ == \"__main__\":\n t = int(input().strip())\n for _ in range(t):\n arr = list(map(int, input().strip().split()))\n ob = Solution()\n print(ob.maxV...
eJytVdtqFEEQ9UHwNw7zHKTr1l2VLxFcEdEFfVnzsIGAGPwI/V+rZ12jIbVJSOZhpqd7+tSp06dqfrz89fnVi/V68yEHb78tX3YXl/vlHAttdtTADdKgDdbQG0aDN0QDtbacYdleXWw/7ref3n+93P/Zx9Y2u+vNbvl+httwuTUQjhiIjjCEIgTBCJqoHnCHD3iHG1zhAmc4ZdgiHvVWBpw0k2v9KDC9lZipgwbUoQPaoQZVqEAZSlMoCYhDBqRDDKIQgTCEimDmUQp2o7+s45xZb8fpAlK4op88YBigzF9AOQiwgJM0TdIzB5m5WX4X...
706,274
Maximum XOR subarray
Given an array arr[]of size,N.Find the subarray with maximum XOR. A subarray is a contiguous part of the array. Examples: Input: N = 4 arr[] = {1,2,3,4} Output: 7 Explanation: The subarray {3,4} has maximum xor value equal to 7. Input: N = 3 arr[] = {1,4,3} Output: 7 Explanation: There are 6 possible subarrays:...
geeksforgeeks
Hard
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "static int maxSubarrayXOR(int N, int arr[])" ], "initial_code": "import java.io.*;\nimport java.util.*;\n\nclass GFG\n{\n public static void main(String args[])throws IOException\n {\n BufferedReader read = new Bu...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "maxSubarrayXOR(self, N, arr)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n t = int(input())\n for _ in range(t):\n N = int(input())\n arr = input().split()\n fo...
eJztms2KZEUQhUXc+BZJrQfJiPz3SQRbXGgv3LSz6AFBBB9C39fvxM1yQLqgexy7e6QGavJO3bzxc+JEnLzF/P7Fn1+ePos/33zOxbe/nn66e/vu/vR1OtnNneWbu5kseTJPI/VUU0uWk9npTTrd/vL29of72x+///nd/fmZdnN3+u1N+ocZvm2ppIWpnqaMGXZqsiJr/MuwXp9k0wnNRgoDTRanrHRZHeGoygemV3jpyQl7XnBR7EEXOPayM5atI/IwWMJLlWHlIetdARCS1+RczOSevD3JY8n6yBxPY6njR0bCZpHBlsJ6pDMilqmw...
703,035
Sorting Employees
You are given two arrays, employee and salary, where employee[i] denotes the name of the i**th employee, and salary[i] denotes the salary of the i**th employee. Your task is to sort the employee array based on their salaries in non-decreasing order. If two or more employees have the same salary, sort them alphabeticall...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "public List<String> sortRecords(List<String> employee, List<Integer> salary)" ], "initial_code": "import java.io.*;\nimport java.util.*;\n\nclass Main {\n public static void main(String args[]) throws IOException {\n ...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "sortRecords(self, employee, salary)" ], "initial_code": "if __name__ == '__main__':\n t = int(input().strip())\n\n for _ in range(t):\n # Read and parse the employee names\n employee = input().strip().split...
eJy1Vl2OmzAQ7kOfeooRz6sqwKZVe5JKS1U5MA1OjG0ZkoatKvUQ7V361qt1sGGBjUlA6RolE5Dn+z48f/n5+vffN6/s+vSHfjx8D7jUhyr4CEGYyEdmGDDBU4SN2kCaMyM4QsZkIterZkHkM6E1wR0EeNKYVph9UYeqxSVvD2ZDlcjgxx2MJZzYkaOBWgkmMwaPuLGSdM5ggxW5fLCrpVxBJ2s9MBNCepQWdszlU8O0FgjKMLkl+UzSBXv+jUNBT1QiQ4jsFU5RWn+7eeTuEH2MGWnKAIVACV9p1x62qAyx50xKlieye1NvOC69vgfT...
705,185
Rotate matrix elements clockwise
Given two integers M, N, and a 2D matrix Mat of dimensions MxN, clockwise rotate the elements in it. Examples: Input: M=3,N=3 Mat=[[1,2,3],[4,5,6],[7,8,9]] Output: 4 1 2 7 5 3 8 9 6 Explanation: Rotating the matrix clockwise gives this result. Input: M=2,N=3 Mat=[[1,2,3],[2,3,3]] Output: 2 1 2 3 3 3 Explanation: ...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "int[][] rotateMatrix(int M, int N, int Mat[][])" ], "initial_code": "// Initial Template for Java\n\nimport java.io.*;\nimport java.util.*;\n\nclass GFG {\n public static void main(String args[]) throws IOException {\n ...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "rotateMatrix(self, M, N, Mat)" ], "initial_code": "# Initial Template for Python 3\n\nimport math\n\nif __name__ == '__main__':\n t = int(input())\n for _ in range(t):\n N, M = map(int, input().strip().split(\" \"...
eJztm02O7FQSRhmwkFCNEXJE+JcN9BaQulo9gDdgUjB4SEgIxCKaTfasd9AnwnamnZm2M5MqVZYwpvReVd289v1OxBf3xpP/+PLP//3ji/zv2//yl3/++vTDy08/f376Rp70+aWU6vlFxcQl/1pLI610ogU/VlETddFSNIbVoo1oK9qJ8fvfn76Sp0+//PTpu8+fvv/3jz9/HqZl2DDhOEfMWUk/Q04XN4jvj9NxB37w+/PL029fyfwZq/4Zh+v5xWS4nl9chitWMlz5gf5afkYbp5N+kpgv/h4z9N/FNP13Lscpy6WHrOPGLIqVeCEl...
702,914
Closest Strings
Given a list of words followed by two words, the task to find the minimum distance between the given two words in the list of words Examples: Input: S = { "the", "quick", "brown", "fox", "quick" } word1 = "the" word2 = "fox" Output: 3 Explanation: Minimum distance between the words "the" and "fox" is 3 Input...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "int shortestDistance(ArrayList<String> s, String word1, String word2)" ], "initial_code": "//Initial Template for Java\n\nimport java.io.*;\nimport java.util.*;\n\nclass GFG {\n public static void main(String args[]) throws...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "shortestDistance(self, s, word1, word2)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n T = int(input())\n for i in range(T):\n n = int(input())\n s = list(map(str, inpu...
eJztmF1u1DAQx3ngBlxgtM8VWuc7nASJIORN3MQ0cdLEYUsREoeAE/LGKZjk75YW7W67LbRdxH7MOon9G489nhntl+fffrx4Nr9ef+fGm08LbbrRLl7RQmRGhJmxlR6IP5Lq1pRU68FSe0zrti8GWmtbzU1B0hRzy6OhbdS6Ur0ibWil7Fop4zopUwyZmdv48TKzOKKFOutUblXxrh2tUz89+XxE1yfkLTMjaUU5T+fi90K6aVy79m6pLNqkTEzKuq5WtJKG39T20pSKyl52l/e2dzjuR20zg0eZmW9unYDYaC0v/xl9pHNnVUFMpZIq...
707,348
All Unique Permutations of an array
Given an array arr[] of length n. Find all possible unique permutations of the array in sorted order. A sequence A is greater than sequence B if there is an index i for which Aj = Bj for all j<i andAi > Bi. Examples: Input: n = 3 arr[] = {1, 2, 1} Output: 1 1 2 1 2 1 2 1 1 Explanation: These are the only possible un...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1620285170, "func_sign": [ "static ArrayList<ArrayList<Integer>> uniquePerms(ArrayList<Integer> arr , int n)" ], "initial_code": "//Initial Template for JAVA\n\nimport java.io.*;\nimport java.util.*;\n\nclass GFG {\n public static void main(String arg...
{ "class_name": "Solution", "created_at_timestamp": 1620285170, "func_sign": [ "uniquePerms(self, arr, n)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n t = int(input())\n for _ in range(t):\n n = int(input())\n arr = list(map(int, input().split())...
eJx8vE2ubLmSnVmNGogj2gkUnMZ9NrdGUkA9QA3pNdR5ysZLQIAgQWOrEdSQKu51N671LUYK+snk50YaaTSaGbnPjf/1f/7f/+//9f/9H//Pf//jv/zjX//tn3/8h9cf77/9o/78v696vf/4l9cff/9v//r3//TPv//n//hf/+2fLfH69esvmff3f/763/72j//5t3/88T/+5cWx5t/+MV6//k/9O6N9f3195OrP//frf6vf9NfY4/u//eXo15//9/X9P//O+Pv3f2+Mn7/94/lz/utPLfe/O8v377ndf0o9f47TrefPdrfW77Zaz5/t...
710,279
Next element with greater frequency
Given an arrayarr[ ]ofnintegers, for every element, find the closest element on it's right that has a greater frequency than its own frequency. Examples: Input: n = 6 arr[] = {2 1 1 3 2 1} Output: 1 -1 -1 2 1 -1 Explanation: 1 appears 3 times. 2 appears 2 times. 3 appears 1 time. For arr[0] ie, 2 arr[1] ie 1 is t...
geeksforgeeks
Medium
{ "class_name": "solver", "created_at_timestamp": 1648717059, "func_sign": [ "static int[] print_next_greater_freq(int arr[], int n)" ], "initial_code": "import java.util.*;\nimport java.io.*;\n\nclass GFG\n{\n public static void main (String[] args)\n {\n Scanner sc = new Scanner(System.in);...
{ "class_name": "Solution", "created_at_timestamp": 1648717059, "func_sign": [ "print_next_greater_freq(self,arr,n)" ], "initial_code": "if __name__ == '__main__':\n t = int(input())\n for _ in range(t):\n n = int(input())\n arr = [int(x) for x in input().strip().split()]\n obj ...
eJy9VsFOwzAM5cCFv7B6HqhJmjbhS5AI4gA9cCk7dNIkBOIj4Fu5IRwn7mCoKR3p6qds1da852fX7evp++fZCR1XH/jl+ql46NabvriEQrjOo8TDdcUKina7bu/69v72cdPH/5wLcN0L/vy8gr1Ly3gtHLSmGBNIiQEJCirQUEMDBiyIJVhK3NggQY1EFRJKEEvk4kNSRj4nzCozifYkKpIIovDWabIPI0VHG8eP+dQS89NookYbDa4NhSgZFIpiQocGWvSEjr/JUihLhnpSkAvRkeBOEGooLMUgmuSOSlXBLzUzJo3U1I7UkZa60lBn...
703,513
Print Bracket Number
Given a string str, the task is to find the bracket numbers, i.e., for each bracket in str, return i if the bracket is the i**th opening or closing bracketto appear in the string. Examples: Input: str = "(aa(bdc))p(dee) " Output: 1 2 2 1 3 3 Explanation: The highlighted brackets in the given string ( aa ( bdc )) p ...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "ArrayList<Integer> bracketNumbers(String str)" ], "initial_code": "// Initial Template for Java\n\nimport java.io.*;\nimport java.util.*;\n\nclass GFG {\n public static void main(String args[]) throws IOException {\n ...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "bracketNumbers(self, str)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n T = int(input())\n for i in range(T):\n S = input()\n ob = Solution()\n answer = ob.brac...
eJzNldtOwzAMhrngjpewehVLE2rSQ1qeBIkhtLVlJyi72CQkBOIh4H2J47ZoFWu6E1raTW2T2M5n/8nn5Xd5dWHb7cQ83L15s3K5Xnk34MlhKdAbgFe8LotsVeQPL+tV3QcShuXHsPTeB9Ca02rYalstKggghAhi0JBACtIHafwokAHIEGQEMrZ3ZF8D2yVpWGrGazMvMvMDY6d3bI5Qjxu5BpmATEH5oMwcBcrEGoKKQMWgNKgEVAqBD4G0t0+v9FHbAZEdHNiJkowYU2RQH8wE97+6mBAV4kJkiA3RIT5EiBkxJibFsJgXI2vyrWt2...
700,551
Count More than n/k Occurences
Given an array arrof size N and an element k. The task is to find the count of elements in the array that appear more than n/k times. Examples: Input: N = 8 arr = [3,1,2,2,1,2,3,3] k = 4 Output: 2 Explanation: In the given array, 3 and 2 are the only elements that appears more than n/k times. Input: N = 4 arr = [2,3...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1615736958, "func_sign": [ "public int countOccurence(int[] arr, int n, int k)" ], "initial_code": "/*package whatever //do not write package name here */\n\nimport java.io.*;\nimport java.util.*;\n\nclass Driverclass {\n public static void main(Strin...
{ "class_name": "Solution", "created_at_timestamp": 1615736958, "func_sign": [ "countOccurence(self,arr,n,k)" ], "initial_code": "# Initial Template for Python 3\n\nimport math\n\n\ndef main():\n T = int(input())\n while T > 0:\n N = int(input())\n A = list(map(int, input().split()))\n...
eJytVUFOwzAQ5IDEN0Y5I2R77bXNS5AI4gA9cAkcWgkJgXgEvJUbYut0G7c0iAQ6EylSlN2Zna3zevz+eXJUfhcfcnP51Nx1D6tlc47Gtp01cqGHKyCBbztqu+YUzeLxYXGzXNxe36+Ww1sv8vD5FHulQtsFKHiDuEFCbjs/WpRGirqiT3WJsg2+N2LpPlrejZUPvX1XtRia1G0qR23HkxvR2odBzVyQCvoZaYeh56BEdP00PzMWivn9ALdZ9XkNyBX2TAy0hU5Jhb4wVGRl3GWqmNd0ZpdW6ZSk9MpQkStG4U/rMTa9tBkelYFxv8bq...
709,992
Enemy
You live in Geek land. Geek land can be seen as a grid of shape N xM.There are Kenemy at Kpositions. Each enemy blocks the row and column to which it belongs. You have to find the largest continuous area that is not blocked.No two enemies share the same row or the same column. Examples: Input: N = 2 M = 2 K = 1 enemy[]...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1650389408, "func_sign": [ "public static int largestArea(int n,int m,int k,int[][] enemy)" ], "initial_code": "import java.io.*;\nimport java.util.*;\nclass IntArray\n{\n public static int[] input(BufferedReader br, int n) throws IOException\n {\n...
{ "class_name": "Solution", "created_at_timestamp": 1650389408, "func_sign": [ "largestArea(self,n:int,m:int,k:int, enemy : List[List[int]]) -> int" ], "initial_code": "class IntArray:\n def __init__(self) -> None:\n pass\n\n def Input(self, n):\n arr = [int(i) for i in input().strip()...
eJzNVEuOEzEUZDELjvHU6xHy8785CRJBs4As2IRZZCQkBOIQM0dkxyGoenaiaGSHDBoQUavjbj+/KldV+/vVw8+XL+z35gcGb78sH3e3d/vltSxhs0uSxG92XjCOorxFjj3fhvY2bnbqBFfCgDWPJtFjuZZl+/l2+36//XDz6W7fAVD2DWvs7pP9LV+v5YQCKqpUg5DKzpmd8ViIkSU3qESUPEEJ1riO2pOsE0/2nbYxzoSpBNQ2pV4UkwoJSCWLokCraO0NJtA6AjX2hfKoFI61w4aD2NrlW2Xl1kbEMIX1SXCVqex9AdAm/GKT/sSG...
705,019
Summing the Sum
Given three integers N, M, and K. Lets Sum(N) be a function that calculates twice the sum of first N natural numbers. Calculate Sum(K+Sum(K+Sum(K+....+Sum(N+K) up to M terms. Examples: Input: N=1, M=2, K=3 Output: 552 Explanation: Sum(3+Sum(3+1))=Sum(3+Sum(4)) =Sum(3+20)=Sum(23)=Sum(552) Input: N=2, M=2, K=2 Outpu...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "long modifiedSum(int N, int M, int K)" ], "initial_code": "// Initial Template for Java\n\nimport java.io.*;\nimport java.util.*;\n\nclass GFG {\n public static void main(String args[]) throws IOException {\n Buffere...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "modifiedSum(self, N, M, K)" ], "initial_code": "# Initial Template for Python 3\n\nimport math\n\nif __name__ == '__main__':\n t = int(input())\n for _ in range(t):\n N, M, K = map(int, input().strip().split(\" \"...
eJy1lM1OwzAMxzkgniPKeUKJG8fxngSJIg7QA5ewQychIdBuewF4X9IPPrbVSaeKtJKjNvnFf8f27vJzf3XRj5tdmty+6qe42bZ6rbSto1XpqaNeKd28bJqHtnm8f9624wJfx/f0822ljnaZfnR7h5lIsEzQ/5/mqB+SSGBGQxUGlBlFL4C5MgZKag6tHBXLgY2zIm82yQZHAJaKnmXic6Y2kUNJECNCRpXCghzHAVACDJvVgZG9Aee9xYrm6pqOu8h3TAy+cmEm3/z3AaOVI+KYQwhkuFwHWXzmgKpbIdb83xw67QGTMatjRlCxsE8k...
703,322
Exceptionally odd
Given an arrayof N positive integers where all numbers occur even number of times except one number which occurs odd number of times. Find the exceptional number. Examples: Input: N = 7 Arr[] = {1, 2, 3, 2, 3, 1, 3} Output: 3 Explanation : 3 occurs three times. Input: N = 7 Arr[] = {5, 7, 2, 7, 5, 2, 5} Output: 5 E...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1619259391, "func_sign": [ "int getOddOccurrence(int[] arr, int n)" ], "initial_code": "//Initial Template for Java\n\nimport java.io.*;\nimport java.util.*;\n\npublic class Main {\n\n public static void main(String[] args) throws Exception {\n ...
{ "class_name": "Solution", "created_at_timestamp": 1619259391, "func_sign": [ "getOddOccurrence(self, arr, n)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n tc = int(input())\n while tc > 0:\n n = int(input())\n arr = list(map(int, input().strip()...
eJytlM1OwzAMxzkgnsPKeULNR5OGJ0GCaQfogcvYoZOQEIiH2B6SG4+A7TSileJuK51/qbq68b+xnXxdH39urvh3/403D+/qZbvbd+oOlH7cRgQaCDgiWwB8pFag2rdd+9S1z5vXfde/j55PdH6sYBxE43DgoEbzbCGZGMlLkWocFfTojGHsAJcQBShQWSGQCmgPhWsA3WTiEFlHWomhUQGhGcNYxjE145nANExkGlGTXOW1YTEnqieVz2L1DBBWnEyu4mQuWEULraho+c7iRQyWnMVwmM7cRVP9I03HJWK7gGGzyeQ8/r8JZ3fhWGKk...
703,389
Total distance travelled in an array
You are given an array arr[] consisting of a permutation of the set {1, 2, 3, …, n} for some positive integer n. The task is to calculate the total distance you must travel starting from the position of 1 in the array, then moving to the position of 2, and so on, until you reach the position of n. Examples: Input: arr[...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "long distance(int[] arr)" ], "initial_code": "// Initial Template for Java\nimport java.io.*;\nimport java.lang.*;\nimport java.util.*;\n\n//Position this line where user code will be pasted.\n\nclass GFG {\n public static ...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "distance(self, arr)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == \"__main__\":\n t = int(input())\n while t > 0:\n arr = list(map(int, input().split()))\n ob = Solution()\n ...
eJydk78KwjAQhx36ID8yF8mf1rY+iWDEQTu4xA4tCKL4ELq6+Z5eSgaLXqUJgQSS77vLJbklj1cy69vqSZP1WRxc07ViCaGsoy5SiPrU1Lu23m+PXRsWpXVXWrykGBIaPKMYRkHDsJRmKAPiWMowVAaDsRw5TvVcjowlC46UqFCiwMLjf8JXYyUiOidLQbYKSk6WfMIIRv6yRs7zlU2ExYt00E1+ZUNBFGxtDM5tZlOkdxoX6YdC0eBUGaPxCXg4ptjho5VTf0zcBUm+xJv7/A0F1Got
710,020
Exactly one swap
Given a string S containinglowercase english alphabetcharacters. The task is to calculate the number of distinct strings that can be obtained after performingexactly one swap. In one swap,Geek canpick two distinct index i and j (i.e 1 < i < j < |S|)of the string, then swap the characters at the position i and j. Exampl...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1646060454, "func_sign": [ "long countStrings(String S)" ], "initial_code": "//Initial Template for Java\nimport java.io.*;\nimport java.util.*; \nclass GFG{\n public static void main(String args[]) throws IOException { \n BufferedReader read =...
{ "class_name": "Solution", "created_at_timestamp": 1646060454, "func_sign": [ "countStrings(self, S)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n t = int(input())\n for _ in range(t):\n S = input()\n ob = Solution()\n ans = ob.countString...
eJxrYJm6joUBDCKWAxnR1UqZeQWlJUpWCkqGMXmJCKCko6CUWlGQmlySmhKfX1qCUFQXk6dUq6OApjMpOSUVlx4DXJpItiUxKQmHFlMcWqrggBwfpaVnZGZl5+Tm5RcUFhWXlJaVV1TiMsjYCJcbEnE5GqfdONTjDEi4W3FoNMHttGQ8CJdPDfAHWlJ6Mm6nmOF0Cs5gMsZjWyJef5visYxw0jAxI2wxESkMnyNwpmdzQlZXEWW3GU4voAQATqfjzrrklRGooZZMXLjFTtEDAFyHmLg=
702,951
Check for subsequence
Given two strings A and B, find if A is a subsequence of B. Examples: Input: A = AXY B = YADXCP Output: 0 Explanation: A is not a subsequence of B as 'Y' appears before 'A'. Input: A = gksrek B = geeksforgeeks Output: 1 Explanation: A is a subsequence of B.
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "boolean isSubSequence(String A, String B)" ], "initial_code": "//Initial Template for Java\n\nimport java.io.*;\nimport java.util.*;\nclass GfG\n{\n public static void main (String[] args)\n {\n Scanner sc = new S...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "isSubSequence(self, A, B)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n T = int(input())\n\n for _ in range(T):\n A, B = input().split()\n ob = Solution()\n if ...
eJxrYJm6n4cBDCJ2ABnR1UqZeQWlJUpWCkqGMXkKiQqJSjoKSqkVBanJJakp8fmlJQjZupg8pVodBTQtQD1JOPQY4NKTmJQMwqRaBdWWQoa+FDz24XQmKDiAWlPT0jMys7JzcvPyCwqLiktKy8orKqtIdgQes6grQ6rLqugD6GVPFelRgzMoqRxn1HMYdWVGkybdAF3SJo7oAJqHqpQc1ygkgswjvQwmLY0lEZHIMqiXzUDW4K1b8FVlQFfQLfnQOSHg9jbMUrqWnxmZFWAxbGkkG4uGYVmGUjflk1m65OFNVSVkly+DIFmNphb87Wja...
702,647
Paths to reach origin
You are standing on a point(x, y) and you want to go to the origin(0, 0)by taking steps eitherleft or down i.e. from each point you are allowed to move either in(x-1, y) or (x, y-1). Find the number of paths from point to origin. Examples: Input: x = 3, y = 0 Output: 1 Explanation: Path used was - (3,0) --> ( 2,0...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "public static int ways(int n, int m)" ], "initial_code": "//Initial Template for Java\nimport java.io.*;\nimport java.util.*;\n\n//Position this line where user code will be pasted.\n\n// Driver class\nclass Array {\n \n ...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "ways(self, n,m)" ], "initial_code": "# Initial Template for Python 3\n\nt = int(input())\nfor _ in range(0, t):\n x, y = list(map(int, input().split()))\n ob = Solution()\n print(ob.ways(x, y))\n print(\"~\")\n", ...
eJytk8FOwzAMhnsYPEeU84Ti1F7iPckkgjhAD1zCDp2EhJj2EON5h9dpKjvYYxWRrFz6Of5//93Nvu/vmuGsDrOmefz0b3W96f3SeSiVQnBSfu5897HuXvru9fl9058/IM4t5cilbkv1X3N3SSOzQVNihsSQFfr4tnSYSEcKTkqjgWgBLZJCm6qNeW9lUBhQX0oxp8SUNI1wdGg6bbkbgrFTmERZy2hjzHGhGUs3+yraxgyoKjEaqzxdKGW4ZGUB+RwKvpKoNiCiuKD+CWKA6l7KKUuYSdMC4yDVDROflqGawlc6QSlj9ir8X+PLTqVM...
703,071
Uncommon characters
Given two strings A and B consisting of lowercase english characters. Find the characters that are not common in the two strings. Examples: Input: A = geeksforgeeks B = geeksquiz Output: fioqruz Explanation: The characters 'f', 'i', 'o', 'q', 'r', 'u','z' are either present in A or B, but not in both. Input: A = c...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1619173735, "func_sign": [ "String UncommonChars(String A, String B)" ], "initial_code": "//Initial Template for Java\n\nimport java.io.*;\nimport java.util.*;\nclass GfG\n{\n public static void main(String args[])throws IOException\n {\n Sca...
{ "class_name": "Solution", "created_at_timestamp": 1619173735, "func_sign": [ "UncommonChars(self,A, B)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n T = int(input())\n\n for tcs in range(T):\n A = input()\n B = input()\n ob = Solution()\n...
eJzNVttu1DAQ5YFHPqLa54JU+tY3/gKJIORNJsk09tjxLUkRiI+A/2WcS3cXEvVCK2rtZif2eub4zPHYP17/+vDm1dg+XrHx6esOyQS/uzrbvc9I7PMCyqrG6zUro0Yq0qa1zq9ZGdUgpfY1OnTCQ+rJa8gbXwufejuUkrQvBcrd+dkOegO5h+KLDn7GcAh27PY7+ykb6kZr9+387BR1P9zcfjJK05ZvRhYMMJQir4UVHMy6EVFGQC5YWIZnBOugkqfRdcJRN6TDGpALDiao0EoOFRDY5NZD7zVBRskotc21MsKi07QRKi/KCqVxw8ZS...
704,595
Longest Bitonic subsequence
Given an array of positive integers. Findthe maximum length of Bitonic subsequence.A subsequence of array is called Bitonic if it is first strictly increasing, then strictly decreasing. Return the maximum length of bitonic subsequence.Note : A strictly increasing or a strictly decreasing sequence should not be consider...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1710841750, "func_sign": [ "public static int LongestBitonicSequence(int n, int[] nums)" ], "initial_code": "import java.io.*;\nimport java.util.*;\n\nclass IntArray {\n public static int[] input(BufferedReader br, int n) throws IOException {\n ...
{ "class_name": "Solution", "created_at_timestamp": 1710841750, "func_sign": [ "LongestBitonicSequence(self, n : int, nums : List[int]) -> int" ], "initial_code": "class IntArray:\n\n def __init__(self) -> None:\n pass\n\n def Input(self, n):\n arr = [int(i) for i in input().strip().sp...
eJytlMtOwzAQRVnAf1x53SKPx3aSfgkSRSxoFmxCF6mEhEB8Qhcgfpex04faMlKMkpei0Z0z4+vH5/X3z81Vvu628nP/Zp679aY3CxhadmTlBSOgQoMaER4O1sxg2td1+9S3q8eXTb9PEPXHsjPvM5xhQkLBWbB8AygIMQqzFh4LkWAxJw3rFKzL3TkheOEdScdY3Mc1NGnooWMSoAdFUJ26l74lGA7wNIAmhYiylLOa879EVJ+iUpVP7E4IzjUrUJNaSI34TLeHyRjUcdfRzgSlsGNtguRRcrQ5ddn78iS9Oy2JB1O0WtqYfErLd0k9...
711,624
Pattern 1
Geek is very fond of patterns. Once, his teacher gave him asquare pattern to solve. He gave Geekan integer n and asked him to build a pattern. Help Geek to build a square pattern with the help of * such that each * is space-separated in each line. Examples: Input: n = 3 Output: * * * * * * * * * Input: n = 5 Output: *...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1662576504, "func_sign": [ "void printSquare(int n)" ], "initial_code": "import java.io.*;\nimport java.util.*;\n\nclass Main {\n // Driver code\n public static void main(String[] args) throws Exception {\n BufferedReader br =\n new Buffer...
{ "class_name": "Solution", "created_at_timestamp": 1663239406, "func_sign": [ "printSquare(self, N)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n t = int(input())\n for _ in range(t):\n N = int(input())\n ob = Solution()\n ob.printSquare(N...
eJzs17Fq3EAUQFEI6fITYspkCznp/CUBC7awVbiRt9CCwdjk07PFNkmRxoXJ5XAGNW8eTHfRr88/v3y7+3T3Mh6303kft9O4WbbLGYdprM+n9X5fH45P5/06/Dot29tl+nqY/lqZ5/kfWwDA/27ZPvoFAMD7KToAFCg6ABQoOgAUKDoAFCg6ABQoOgAUKDoAFCg6ABQoOgAUKDoAFCg6ABQoOgAUKDoAFCg6ABQoOgAUKDoAFCg6ABQoOgAUKDoAFCg6ABQoOgAUKDoAFCg6ABQoOgAUKDoAFCg6ABQoOgAUKDoAFCg6ABQoOgAUKDoA...
704,022
Minimum number of deletions and insertions
Given two strings str1 and str2. The task is to remove or insert the minimum number of characters from/in str1 so as to transform it into str2. It could be possible that the same character needs to be removed/deleted from one point of str1 and inserted to some another point. Examples: Input: str1 = "heap", str2 = "pea"...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "public int minOperations(String s1, String s2)" ], "initial_code": "// Initial Template for Java\nimport java.io.*;\nimport java.util.*;\n\nclass GfG {\n public static void main(String args[]) {\n Scanner sc = new Sc...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "minOperations(self, s1, s2)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n T = int(input())\n\n for i in range(T):\n s1, s2 = input().split()\n ob = Solution()\n ...
eJy9lUtOwzAQhlmw4BiW1xUiKQXESZAIQs376bzsJDYCcQi4IDtuQYSqCkT/OG4rJptIHvnz7/ln/Hr6/nl28h13H+PP/RNNWCU4vSXUctja9fwgjOIkzfKClVXdtFx0/SAVUXLoO8Hbpq5KVuRZmsRRGPieu6YLQoOhCjwe+I+l4JvtVhcOe3EYfV6QeRCCFhQgWBCg+8iwI5COy/0x7p9AUm4ARGmDyDF0SQB7ZVii0Qd4CTCQDWYo06coCai2sTJscHPNtvnFYjqC4AZTrvQGvw+6UEQ8bpMmrbMqLwtm3sVQyYzaHOLMa3Nn/tSG...
869,869
Two Smallests in Every Subarray
Given an array of integers arr, the task is to find and return the maximum sum of the smallestandsecond smallest element among all possible subarrays of size greater than one. If it is not possible, then return -1. Examples: Input: arr = [4, 3, 1, 5, 6] Output: 11 Explanation: Subarrays with smallest and second smalle...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1720590580, "func_sign": [ "public int pairWithMaxSum(int[] arr)" ], "initial_code": "import java.io.*;\nimport java.util.*;\n\nclass GFG {\n public static void main(String[] args) throws IOException {\n BufferedReader br = new BufferedReader(n...
{ "class_name": "Solution", "created_at_timestamp": 1720586997, "func_sign": [ "pairWithMaxSum(self, arr)" ], "initial_code": "if __name__ == \"__main__\":\n import sys\n input = sys.stdin.read\n\n data = input().strip().split(\"\\n\")\n t = int(data[0])\n lines = data[1:]\n\n for line i...
eJyVVMtOAzEM5ID4jlFuSAVtYufFlyBRxAF64FJ6aKVKCMRHwP/iOCshSr10c5jZPNaPsZOP86/LizMdt04+7l7d83qz27obOL9c+6ENt4Bb7Terx+3q6eFltx33r+TA+3Lt3hb4/VcAwYOREFCFo8xIMKPIPMgsyyrJfpFVmRsOfDYc9LBQ21AsilkxKUZFViTFoOgVrZS8mrS8YvR7nAyTQbfNRBAG0AAeEAekAXlAkczUbKOiS0m3WY+GtmfGb3v6CXZMJHSiTtwpdkqdcqfSqU6kaNYqjMUXG4Qg39IPMqvwzAhEoJyRRIhaxFuU...
703,497
Extract Maximum
Given a alphanumeric string S, extract maximum numeric value from S. Examples: Input: S = 100klh564abc365bg Output: 564 Explanation: Maximum numeric value among 100, 564 and 365 is 564. Input: S = abcdefg Output: -1 Explanation: Return -1 if no numeric value is present. Constraints: 1 ≤ |S| ≤ 10**4 -1 ≤ output...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "static int extractMaximum(String S)" ], "initial_code": "//Initial Template for Java\n\nimport java.io.*;\nimport java.util.*;\n\nclass GFG{\n public static void main(String args[]) throws IOException { \n Scanner sc...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "extractMaximum(self,S)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n T = int(input())\n for _ in range(T):\n S = input()\n ob = Solution()\n print(ob.extractMax...
eJydVFtOwzAQ5APuEfm7VHYebcJJkDBCsWNof9wWpaINasUh4Bb8cUHWThtU0UnSWIoUaz27s+Pxflx//dxc+XX/TT8P72xul+uS3QVMSMvdykUY5TyZTJVmo4CZzdLo0hRPi3V5OEkxaffSst0oOE2Q5UqnlKOibwrQLg7gm20FQLcCQKKxiEWSAZiPASQxVAtbYKKoydyppAAItUaixqRbmvHVm3ktt80eMW/Og4SVW/UpEr0wz5MkjkIB0tVB1JDS/uY5QiOgc4rSxIDKE9WX2ZyLEKmZoos4tNr4z/4ZsFMfzAxLNKgaKtS46EIT...
704,477
Perfect Numbers
Givena number N, check if a number is perfect or not. A number is said to be perfect if sum of all its factors excluding the number itself is equal to the number. Return 1 if the number is Perfect otherwise return 0. Examples: Input: N = 6 Output: 1 Explanation: Factors of 6 are 1, 2, 3 and 6. Excluding 6 their sum ...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1731675234, "func_sign": [ "static int isPerfectNumber(int N)" ], "initial_code": "// Initial Template for Java\n\nimport java.io.*;\nimport java.util.*;\n\nclass GFG {\n public static void main(String args[]) throws IOException {\n BufferedRea...
{ "class_name": "Solution", "created_at_timestamp": 1731675234, "func_sign": [ "isPerfectNumber(self, n)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n t = int(input())\n for _ in range(t):\n N = int(input())\n\n ob = Solution()\n ans = ob.i...
eJxrYJm6hIUBDCLmAhnR1UqZeQWlJUpWCkqGMXmGSjoKSqkVBanJJakp8fmlJVCptMSc4tSYvLqYPKVaHQVUPUbk6LHAoamkqBSXHhNLM9I1WRiSY5WxsampgbExGfZZQoCxORmBArXVlAytEFvJij1yXAoNWNwxgk8zUBeZKc0Q6k2Qs8GJCGfc4jOFHD3gqIGFs6GxcUwMOT6HBRvY7WSFHUiniSGZwQ6ynuyghzg9JoYCx0NdADLLkBg3xE7RAwBxkX7Y
701,190
Tower Of Hanoi
The tower of Hanoi is a famous puzzle where we have three rods and n disks. The objective of the puzzle is to move the entire stack to another rod. You are given the number of discs n. Initially, these discs are in the rod 1. You need to print all the steps of discs movement so that all the discs reach the 3**rd rod. A...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1731402183, "func_sign": [ "public int towerOfHanoi(int n, int from, int to, int aux)" ], "initial_code": "// Initial Template for Java\n\n/*package whatever //do not write package name here */\n\nimport java.io.*;\nimport java.util.*;\n\nclass Recursion...
{ "class_name": "Solution", "created_at_timestamp": 1731402183, "func_sign": [ "towerOfHanoi(self, n, fromm, to, aux)" ], "initial_code": "# Initial Template for Python 3\n\nimport math\n\n\ndef main():\n T = int(input())\n\n while T > 0:\n N = int(input())\n ob = Solution()\n p...
eJy1VMFOwzAM7YHxHVXO0xTHTbLuSyYRxAF64FJ26CQkNImPYL+L5iRtqfCSjgFVlUPi9/ye7eT95ri4LcK3/VwUxd2beG53+05sSgGuBSOWpWhed81j1zw9vOy7/sxojdq14rAsJwhFCNqFBAiVNZaOGQ5ps3ItwWUCCgbXFEW/ZGhCAgZaSBOsoYYxhlF40SoIwLCmHFSy1iHGhpU78Ql03j73LgOTSsDiKZ61HbEmqzkG9Q3jNHpwApjtQGxcLOPZNsTiJSfGjhpmfPzCCKhBm6+nGj3l22kHRAV1hZIzEwOrUs4qQiDN+cyJvbiX...
712,031
Pattern 14
Geek is very fond of patterns. Once, his teacher gave him a pattern to solve. He gave Geekan integer n and asked him to build a pattern. Examples: Input: 5 Output: A AB ABC ABCD ABCDE Constraints: 1<= N <= 20
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1662630271, "func_sign": [ "void printTriangle(int n)" ], "initial_code": "import java.io.*;\nimport java.util.*;\n\nclass Main {\n // Driver code\n public static void main(String[] args) throws Exception {\n BufferedReader br =\n new Buff...
{ "class_name": "Solution", "created_at_timestamp": 1663310708, "func_sign": [ "printTriangle(self, N)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n t = int(input())\n\n for _ in range(t):\n N = int(input().strip())\n ob = Solution()\n ob.p...
eJztW1lz0zAQ5oEZ3vgNGT93OnaOJuGJct8FylGoSyltgHK4ARIoLe3wI+D/os8JTdxI9krO2rLrTPLFlnalPXTseqzf5/9evHwu/KxdEBfrh85u0B8OnEs1x/MD8XUWak5vv9/bHvR2NveGg3Hlsh8ci8qjhVqUo+7GsSxfwe9qCNdGeH38d+P//82Ti1uTq9tTl3emr+9Gbu5F7+6fun1w+n5lpuDhbMkjSdFjWdmqtPCJwlJeJpaa7bruBy2z3kVbrJI1wgEHyeJH0dzlqEbmxAnN0AnjEeK1TP1wRnwkHcRihjUpK6FUK2tVzWc4...
703,381
Length of longest subarray
Given an array arr[], return the length of the longest subarray of non-negative integers.Note: Subarray here means a continuous part of the array. Examples: Input: arr[] = [2, 3, 4, -1, -2, 1, 5, 6, 3] Output: 4 Explanation : The subarray [ 1, 5, 6, 3] has longest length 4 and contains no negative integers Input: ar...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "public int longestSubarry(int arr[])" ], "initial_code": "// Initial Template for Java\n\n/*package whatever //do not write package name here */\n\nimport java.io.*;\nimport java.util.*;\n\n//Position this line where user code...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "longestSubarray(self, arr)" ], "initial_code": "# Initial Template for Python 3\nif __name__ == '__main__':\n tc = int(input())\n while tc > 0:\n arr = list(map(int, input().strip().split()))\n ob = Solutio...
eJytVEsOgjAQdWE8x6Rr0A4/0ZOYiHGhLNwgC0hMjMZD6H0FCoFWplBDB1r6fW9mXnnNP8FiVpXdqvjY39klSfOMbYFhlHCwETigaIRhx+pZ8drSaGvILGDxLY1PWXw+XvOsOZ9HyTNK2MMCGdVGXpXuGT+mgAgKGjCPAEPBW1/1mTxBwSLpIyiPdLI8RK6kYAMatU6pUYXggAse+GU3gDWEsDFEblJKxalvGycWK8tsKgoaZRE7KEVqY0PRdAfkPRkHk5i2+J2k/EUFp+EiNK2qG/mwyMNezZRuIRlcMx6dELWMkGs4OeMunjPyNpE/...
703,845
Sub-arrays with equal number of occurences
Given an array arr[] and two integers say, xand y, find the number of sub-arrays in which the number of occurrences of x is equal to the number of occurrences of y. Examples: Input: arr[] = [1, 2, 1] , x= 1 , y = 2 Output: 2 Explanation: The possible sub-arrays have same equal number of occurrences of x and y are: ...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1617814710, "func_sign": [ "static int sameOccurrence(int arr[], int x, int y)" ], "initial_code": "// Initial Template for Java\nimport java.io.*;\nimport java.util.*;\nimport java.util.HashMap;\n\n//Position this line where user code will be pasted.\np...
{ "class_name": "Solution", "created_at_timestamp": 1617814710, "func_sign": [ "sameOccurrence(self, arr, x, y)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n tc = int(input())\n while tc > 0:\n arr = list(map(int, input().strip().split()))\n x = i...
eJzFVEsOgjAQdWE8x6RrYmihFTyJiRgXysINuoDExGg8gSu5r0NBscLIRxJn2qSQzkvnvddex2k6GelY3HCxPLFddEhiNgfGgygbto7XglnAwuMh3MThdr1P4nLzJYjY2YIPhLwKOJRATViCwoIiNYYgqm2iWkCRvao5VjrgggQFM/DAx34QJWuFQHJoSrDaQxSFaC6iiqwjiYNAkrLDoaD+pHpS2knVxHhTvvnE10FJS7OS0WDOr0IJmpSK5zq5z2/lPt7ZQMZVcnrdpQrvyvys06Kw1vMfJQz3uzg/V2gwlxnUFLIPxFBtDmPYf4sa...
702,729
Pairs which are Divisible by 4
Given an array arr[] of positive integers, count the number of pairs of integers in the array that have the sum divisible by 4. Examples: Input: arr[] = [2, 2, 1, 7, 5] Output: 3 Explanation: (2,2), (1,7) and (7,5) are the 3 pairs. Input: arr[] = [2, 2, 3, 5, 6] Output: 4 Explanation: (2,2), (2,6), (3,5) and (2,...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1617734945, "func_sign": [ "public static int count4Divisibiles(int arr[])" ], "initial_code": "// Initial Template for Java\n\n/*package whatever //do not write package name here */\n\nimport java.io.*;\nimport java.util.*;\n\n//Position this line where...
{ "class_name": "Solution", "created_at_timestamp": 1617734945, "func_sign": [ "count4Divisibiles(self, arr )" ], "initial_code": "# Initial Template for Python 3\nif __name__ == '__main__':\n tc = int(input())\n while tc > 0:\n arr = list(map(int, input().strip().split()))\n ob = Solu...
eJylVEEOgjAQ9KD/2PRMDNsWBN/hwQSMB+XgpXqAxMRofIT+17qKIGFJq20ITdqd3Zmd9jq+Z5MRjeXCLrKT2JlDVYo5CMwNigBEcTwUm7LYrvdV+d4Kc3PJjTgH8H1ee55XEMEMkEujmDAJNJmomIlCoOlLCRJACRj7ZgttiajBP44GMH9vzhIUaCtzbIVOILU4DARyCqBF6HwMhIxcSPVDvnaVA9fBTtlWKf9ekUpUp6bMtWCNa0g6pnJODZeeDLYkZeX8g2vYBXj6tLlUvGNZf7RApWU0YHpHiJbs+Atay3GJq9YsWP89VJ8VB1g/...
712,699
Triangle Path Sum
Given atrianglearray, returnthe minimum path sum to reach from top to bottom. Examples: Input: n = 4 triangle = [[2], [3,4], [6,5,7], [4,1,8,3]] Output: 11 Explanation: 2 3 4 6 5 7 4 1 8 3 The minimum path sum from top to bottom is 2 + 3 + 5 + 1 = 11. Input: n = 1 triang...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1668704248, "func_sign": [ "public int minPathSum(ArrayList<ArrayList<Integer>> triangle)" ], "initial_code": "// Initial Template for Java\n\nimport java.io.*;\nimport java.lang.*;\nimport java.math.*;\nimport java.util.*;\n\nclass GFG {\n\n public s...
{ "class_name": "Solution", "created_at_timestamp": 1668371663, "func_sign": [ "minPathSum(self, triangle)" ], "initial_code": "# Initial Template for Python 3\n\n# Position this line where user code will be pasted.\n\nif __name__ == '__main__':\n t = int(input())\n for _ in range(t):\n n = i...
eJy1VD1PwzAQZUD8jifPDbLjz+OXIBHEAB1YQodUQkIgJjY2+L+cHSgk9KJC2sg5nxPfvfPzs5+P319Pjspz/sLOxYO6bVfrTp1Bmabl5tUCanm/Wl53y5uru3X3+dc37VPTqscFhiF101ZGs/GopNjKSNG2aTlWozfQQgIthLtSskFvNh2MkMcJebg8oxmECJS4i6AA4q/kQBZUg3gWaSRCSkgRKUgQUSq2gOQXm27gjQfcpL2QIGzho+6JqEUa7ASdOvNQs4UtrsuuzyaUccxuyoayyfOlMo0rEVuhQlGOBUMGeEQG4n1LsIWCOnt5...
704,554
Geek and its Game of Coins
Given three numbers n, x, and y, Geek and his friend are playing a coin game. In the beginning, there are n coins. In each move, a player can pick x, y, or 1 coin. Geek always starts the game. The player who picks the last coin wins the game. The task is to determine whether Geek will win the game or not if both player...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1715546011, "func_sign": [ "public static int findWinner(int n, int x, int y)" ], "initial_code": "import java.io.*;\nimport java.util.*;\n\nclass GFG {\n public static void main(String[] args) throws IOException {\n BufferedReader br = new Buf...
{ "class_name": "Solution", "created_at_timestamp": 1715546011, "func_sign": [ "findWinner(self, n : int, x : int, y : int) -> int" ], "initial_code": "if __name__ == \"__main__\":\n t = int(input())\n for _ in range(t):\n n = int(input())\n x = int(input())\n y = int(input())\n...
eJylVL0OgjAQduBBSGdi2qsF9UlMPOOgDC4nAyQmRuND6Iu6uVkLBjQ5ySFTSft9/X4OLtHtEY3Cs7j7xfKodlRUpZrHyiAZjQRITiWxyg9Fvinz7Xpfle2JM5I6JfEXzCGlSDMhLEOySBMGpRkU+I3pS6oU58KNxghVWk/ooQakoUCwlwphTjc1cP5Ynbb2Z6U6ta4btNJEg0zXjZYfHY7DfljWzQv0TsfP1EEee33bHzG2BIgDKd6TJmNj24FOvHy+XFC9n1//74KjyLo9DWo5mBikZXUdPwFS6JPT
702,678
Missing And Repeating
Given an unsorted array arr of of positive integers. One number Afrom set [1, 2,....,n] is missing and one number Boccurs twice in array. Find numbers A and B. Examples: Input: arr[] = [2, 2] Output: 2 1 Explanation: Repeating number is 2 and smallest positive missing number is 1. Input: arr[] = [1, 3, 3] Output: 3...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1729242317, "func_sign": [ "ArrayList<Integer> findTwoElement(int arr[])" ], "initial_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList; // Import ArrayList\nimport java.uti...
{ "class_name": "Solution", "created_at_timestamp": 1729242317, "func_sign": [ "findTwoElement( self,arr)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n tc = int(input())\n while tc > 0:\n arr = list(map(int, input().strip().split()))\n ob = Soluti...
eJyllMFuwjAQRDmU/xj5jFDWSeqEL6lEqh4gBy4phyAhVUX8A+XC17JxCqpKJoYQ5RDF2rfjGa/3L8fTeOSft4N+zL/MqlpvajODkaISiJnAlNt1uajL5cfnpr4swhbVrqjM9wT/ayxiJEjxCocMOXLCyCERg0S45TQ/I6ZH18KKUlKtPUht0118tfUqMkJQfYHuf3ehvlpIDEn0ZTtSwQTZZUyLtAyma9zqXClOaalSY5XbF7swjlPEVRgpd1RF7PNuJfS57O7KqSs4ThVkwZPT6Tp1mx6nq9n3WN0JwcCxDBjURDDQpDa6J7Jjm4nw...
700,517
Index of an Extra Element
You have given two sorted arrays arr1[] & arr2[] of distinct elements. The first array has one element extra added in between. Return the index of the extra element. Examples: Input: n = 7, arr1[] = {2,4,6,8,9,10,12}, arr2[] = {2,4,6,8,10,12} Output: 4 Explanation: In the first array, 9 is extra added and it's index...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1731322769, "func_sign": [ "public int findExtra(int arr1[], int arr2[])" ], "initial_code": "import java.io.*;\nimport java.util.*;\n\npublic class Main {\n\n public static void main(String[] args) throws Exception {\n BufferedReader br = new ...
{ "class_name": "Solution", "created_at_timestamp": 1731322769, "func_sign": [ "findExtra(self,arr1,arr2)" ], "initial_code": "if __name__ == '__main__':\n tc = int(input())\n while tc > 0:\n # Take the first array as input\n arr1 = list(map(int, input().strip().split()))\n\n # ...
eJzt2s3OHFcRxnEWXMiR1wHN+agvxIUgEcQCvGBjskgkJITERcCKHVfK/5mpF1mOJ8YWIgnuSIeOSPmx3/Pr6VPVnr/+9O///OVP7v/86h/8y6///OoPb7765utXvxiv5pdv5lhjjzNs+IiRo8a8jTnHXGPuMc+YNqaPGWPmmDXWbSx+zRprj3XGsrF8rBgrx6qxb2PPsYncY5+xbWwfO8bOsWuc2zhznDUOv+MZx8bxcWKcHKeG3YbNYWvYHsYfyIb5sBiWw2r4bfgcvobv4Wc4f14fHsNzeI24jZgj1og94oywEfw4MSJH1MjbyDly...
711,146
City With the Smallest Number of Neighbors at a Threshold Distance
There are n cities labeled from 0 to n-1 with m edges connecting them. Given the array edgeswhere edges[i] = [fromi, toi ,weighti]represents a bidirectional and weighted edge between cities fromiand toi, and given the integer distanceThreshold. You need to find out a city with the smallest number of cities that are rea...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1656482103, "func_sign": [ "int findCity(int n, int m, int[][] edges,int distanceThreshold)" ], "initial_code": "// Initial Template for Java\n\nimport java.util.*;\nimport java.io.*;\nimport java.lang.*;\n\nclass Main {\n public static void main(Stri...
{ "class_name": "Solution", "created_at_timestamp": 1656437729, "func_sign": [ "findCity(self, n : int, m : int, edges : List[List[int]], distanceThreshold : int) -> int" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n T = int(input())\n for t in range(T):\n ...
eJztlj1OAzEQRikoOcRo6wjZY3s35iRIBFFACppAkUhICMQh4Dx0nItvPm8SQPKSiH+JFM+JEr8Zj2ft3O0+PO3t8HX4iDdH18357HIxbw6k8ZOZCuDE2+CbkTTTq8vp6Xx6dnKxmK9/djuZNTcjqc91W84NEtZxpTepKKwVk1ZMcWkKxRQtsSAJn2pJhYoq2eQXKrU8o7RmjGbsthS20q0rVIRO+qXHEiwx01IBxLAhVaKkShTvJPdhXO9ypQg22gpspNzZIluOyI1jJ2OOY8nl+1rVcj28T8PL9MtltqWYHTcagYMN2X7CNPvs+uT6...
703,325
Subset with no pair sum divisible by K
Given an array arr[] of integers. Your task is to find the maximum size of a subset such that the sum of each pair of this subset is not divisible by k. Examples: Input: arr[] = [3, 7, 2, 9, 1] , k = 3 Output: 3 Explanation: Maximum size subset whose each pair sum is not divisible by K is [3, 7, 1] because, 3+7 = 10...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "static int subsetPairNotDivisibleByK(int arr[], int k)" ], "initial_code": "// Initial Template for Java\nimport java.io.*;\nimport java.util.*;\nimport java.util.HashMap;\n\n//Position this line where user code will be pasted...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "subsetPairNotDivisibleByK(self, arr, k)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n tc = int(input())\n while tc > 0:\n arr = list(map(int, input().strip().split()))\n ...
eJzFVctOwzAQ5MCFvxjlXCG/Y/MllQjqAXrgEnpoJSQE4iPgf1nvuqWVkjZJeexlEifesWfH6/fLz8XVBcd8Tg+3L9Vju9qsqxtUumm14kDiEIgCtUAQ8AJOwAoYAcrD82w1Q7V8Xi3v18uHxdNmveVRTfvWtNXrDN3sGgYWDh4BNYgfmgY1tIG20A7aQwfoGjpCJxiV505lM8QUiCVzGM4ecl5DXwyMgwkwEVbB0qocbICNcJTVjKYcK6SAlCNKOWKklffxntLVWOdJ0piUznvxoSZxVR5GfiYm/oM051HwH0nmcZrJFT3PV6Jc77aP...
703,532
Last index of a character in the string
Given a string S and a character X, the task is to find the last index (0 based indexing) of X in string S. If no index found then the answer will be -1. Examples: Input: S = "Geeks", P = 'e' Output: 2 Explanation: Last index of 'e' is 2. Input: S = "okiyh", P = 'z' Output: -1 Explanation: There is no character as...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "int LastIndex(String s, char p)" ], "initial_code": "//Initial Template for Java\n\nimport java.io.*;\nimport java.util.*;\n\nclass GFG\n{\n public static void main(String args[])throws IOException\n {\n BufferedR...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "LastIndex(self, s, p)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n t = int(input())\n for _ in range(t):\n s = input().strip()\n p = input().strip()[0]\n\n ob ...
eJy9VklTwjAU9uDFizfvTM/osHjBW1lT9qWFgnGcLilFJWwtlDo6/gj9v0YYFBxepMKQad502ve+t+R7Sd5OPy7OThZDPWcvt89Cjw5dR7gJCVFMc1bXUdi0FMvqKhlMFSEcEog3JIZDzPuB66x045i+Yiq8hENrCDFMRU03TPIjDF0j5obAVMd0NCNjZ+72BkNtYlpd++HxyfeMqU77yz+Y+oDneGzhOZrYFgBLYeGVIfYYZJ8OhqPxxHGnM2/ui8lUOpPNISlfKJbKlWqt3pCVZkttd/5jg6kK1SYSBWJDSEQ2ytu2hiTUs22EqQSB...
700,367
Smallest divisible number
Given a number N, find an integer denoting the smallest number evenly divisible by each number from 1 to n. Examples: Input: N = 3 Output: 6 Explanation: 6 is the smallest number divisible by 1,2,3. Input: N = 6 Output: 60 Explanation: 60 is the smallest number divisible by 1,2,3,4,5,6. Constraints: 1 ≤ N ≤ 25
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1617189914, "func_sign": [ "public static long getSmallestDivNum(int n)" ], "initial_code": "//Initial Template for Java\n\nimport java.io.*;\nimport java.util.*;\n\npublic class GFG {\n public static void main(String[] args) throws Exception {\n ...
{ "class_name": "Solution", "created_at_timestamp": 1617189914, "func_sign": [ "getSmallestDivNum(self, n)" ], "initial_code": "#Initial Template for Python 3\n\nif __name__ == '__main__':\n t=int(input())\n for tcs in range(t):\n n=int(input())\n ob = Solution()\n print(ob.getS...
eJzNUz1LxEAQtdD/EVIfMt8z6y8RPLHQFDbxijsQRLG0s9H/6ySiYjEXtTIsIWT37bz35s3j4evz0cH8nD7lx9ldfz1udtv+pOtxPWK/6vrhdjNcboeri5vd9mvrYT3296vu+3nSAkDmjigiABW0QlbnpQAoqxBFRFUJK5JskKuqBxVBJm+kNbAycRFYWrIE5D9bE1XDiZRISlwu2mdSFRgsm9FUJ6KaYi05izZFVkTgSOkUwMrezMiURd2tTNZsZVWmTPIkZ1lXhtqiiZOwi4tgcDRycvPGualszYJYCSX/mQW6ZQ8ozAmNJA+weyAE...
702,733
Finding-Pairs
You are given an array of character pairs and a string s. Your task is to count how many of the character pairs from the array appear in the string s. Examples: Input: arr[] = [('A','G'),('d','i'),('P','o')], s = "APiod" Output: 2 Explanation: In the string "APiod" , the pairs (d, i) and (P, o) appear. Thus, t...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "public int countPairs(List<char[]> arr, String s)" ], "initial_code": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n\n int ...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "count_pairs(self, arr, s)" ], "initial_code": "def main():\n import sys\n input = sys.stdin.read\n data = input().strip().split('\\n')\n\n t = int(data[0])\n\n index = 1\n solution = Solution()\n\n while t...
eJzVVUtv00AQ5sCJX/HJ5wpBuXGLnWfL6zjAVsjeXXvtOOtH/CqIih/ADfi/XbtNU5UE1VXSiLns7Nqa+eab14+nf349e9IJ/TTK529WqNOysF7DesX0wIXtweEYCoxke7c9hw9Fq48DTBSmodHuJYFS4Y0wTR8/YWA7GI7Gxq7tmHMynZ2cvjEfrCNYskklL6T4kpTFNaCZ5kmem1d0GOEn+cItmO77bn0/wq04j5lOM+RLFCWqGs15e6/qosyXre564ALSZ1r6XLjejsDdAfGS6XgBnWAFhel8WZTxQidp1tPl36bDCPMYC40kRZZj...
700,497
Smallest range in K lists
Given K sorted lists of integers,KSortedArray[]of size N each. The task is to find the smallest range that includes at least one element from each of the K lists. If more than one such range's are found, returnthe first such range found. Examples: Input: N = 5, K = 3 KSortedArray[][] = {{1 3 5 7 9}, {0 2 4 6 8}, ...
geeksforgeeks
Hard
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "static int[] findSmallestRange(int[][] KSortedArray,int n,int k)" ], "initial_code": "import java.util.*;\nimport java.io.*;\nimport java.lang.*;\n\npublic class DriverClass\n{\n\tpublic static void main(String args[]) \n\t{\n...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "smallestRange(self, KSortedArray, n, k)" ], "initial_code": "# Initial Template for Python 3\n\nt = int(input())\nfor _ in range(t):\n line = input().strip().split()\n n = int(line[0])\n k = int(line[1])\n numbers ...
eJztmd1uFFcQhHOR14jU2muETp//w5NEZKMIEV/kZuHCSJEQKA8B78tX7QQEZjbGAdvEa6kka2emT3V1dfdo968f3z756Yf4+/kx//zycvfH4fmL890j2/n+0K3uD27NlnkxH5b5sNo0z+bdcrLMDcWGuZs382W57A/Zunkyr+bTct4fdg9sd/bn87On52e///bsxfk/Jyj8ay6/emAfHzyscXDSCSVZTdaS9WQj8Wmz3Kw0q81as95scO+nn9jkw48ftZlsJd16KcQmQyKUtsEReuSa7HM0j5x1Qc4WYWfoM61Mq9PatD5tTJvT1tyk...
703,201
Longest Common Substring
You are given two strings str1 and str2. Your task is to find the length of the longest common substring among the given strings. Examples: Input: str1 = "ABCDGH", str2 = "ACDGHR" Output: 4 Explanation: The longest common substring is "CDGH" which has length 4. Input: str1 = "ABC", str2 = "ACB" Output: 1 Explanatio...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "public int longestCommonSubstr(String s1, String s2)" ], "initial_code": "// Initial Template for Java\n\nimport java.io.*;\nimport java.util.*;\n\nclass GFG {\n public static void main(String args[]) throws IOException {\n...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "longestCommonSubstr(self, s1, s2)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n t = int(input())\n\n for _ in range(t):\n S1 = input().strip()\n S2 = input().strip()\n...
eJzFVttu00AQ5YEnviLyc4VICkXqW9qkQGlJSwoEWITs9fqS2DPO7jp2gkB8BPwv60ugqJ4oqUxxJGt2NjNnLmcm+X7/Z//BvfKZHBrh4xcrhCTV1mHH2mdgO9wVnh+E01kUAyZzqXS6yPLlqn90PBiePHv+4vTl2fmr0cXl6/HVm7fvJu8/MFgt82yRaiXnCUIczaZh4HvC5Y7NoPLCoHJWIzAoMay9jiXyRHAt3M+Y6jqOLoNvDJ6U70fl2/q617kWaI/BVSAu05DPjiRmcIL5aRonarQQ0lyc2avlAH0GOhCRkV30p8U1mmujmhd2...
704,467
Break a number
Given a really large number N, break it into 3 whole numbers such that they sum up to the original number and find the number of ways to do so. Since this number can be very large, return it modulo 10**9+7. Examples: Input: N = 2 Output: 6 Explanation: Possible ways to break the number: 0 + 0 + 2 = 2 0 + 2 + 0 = 2 ...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "int waysToBreakNumber(int N)" ], "initial_code": "\nimport java.io.*;\nimport java.util.*;\n\nclass GFG\n{\n public static void main(String args[])throws IOException\n {\n BufferedReader read = new BufferedReader(...
{ "class_name": "Solution", "created_at_timestamp": 1671212611, "func_sign": [ "waysToBreakNumber(self, n)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n t = int(input())\n for _ in range(t):\n n = int(input())\n\n ob = Solution()\n print(ob...
eJytlM1KxTAQhV2Iz1Gyvsh0kkkTn0Sw4kKLuKl30QuCKD6Evq8hyfQHM+0tmNWQdGZOvpzp1+VPf3UR1+1zCO7e1Ut/PA3qplJ120Pbq0Olurdj9zh0Tw+vp2E6/AyHH4dqmVGLGVrKAF5yMxJyPS8xFUWhqA3ZxsmpBNZr4xFLFcImQRQvq9ZoYyrVVFShI+BwhBuYEzor1JhBmLPkXbfFJtNFJ9xzVl++LNcq1aBRWOjCgebAcEBbLjDeEqQO6J2FHBtjHe+TN4b3G1Mj7/99f0j23m/XpXfE/KaIc3ry3L4tlTzHDUiSQtg7shCJ...
701,199
Possible Words From Phone Digits
Given a keypad as shown in the diagram, and an N digit number which is represented by array a[ ], the task is to list all words which are possible by pressing these numbers. Examples: Input: N = 3, a[] = {2, 3, 4} Output: adg adh adi aeg aeh aei afg afh afi bdg bdh bdi beg beh bei bfg bfh bfi cdg cdh cdi ceg ceh cei...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1616269931, "func_sign": [ "static ArrayList <String> possibleWords(int a[], int N)" ], "initial_code": "//Initial Template for Java\n\nimport java.util.*;\nimport java.io.*;\nimport java.lang.*;\n\nclass PhoneDigit\n{\n public static void main(String...
{ "class_name": "Solution", "created_at_timestamp": 1616269931, "func_sign": [ "possibleWords(self,a,N)" ], "initial_code": "# Initial Template for Python 3\n\nimport math\n\n\ndef main():\n T = int(input())\n\n while T > 0:\n N = int(input())\n a = [int(x) for x in input().strip().spl...
eJxE280KbVuWlVEQn8HyIcoWTP/S9BUsC4IJ4t65lnM6RvQeEUaS51wrPrqV5LbaLqwNszCgwwft//3L//Zf/uu/+hf//f/+4eZP//jXP/znH3/4m7/P3/ybv8/f/fhPP/72x3/88R9+/Psf/+7Hv/3xdz/+9g//+scfnp9/er5/ff7hf/Qf//rPf/inv/7pj//7f/3D//ynP/34/eef/fyLn//n958/ffvTtz99+9O3v3z7y7e/fPvLt7/59jff/ubb337/9uO9H+/9eO/Hez/e+/Hej/d+vPfjvR/v/Xjvx3s/3vvx3o/3frz3671f...
701,372
Combination Sum
Given an array of integers and a sum B, find all unique combinations in the array where the sum is equal to B. The same number may be chosen from the arrayany number of times to make B. Examples: Input: N = 4 arr[] = {7,2,6,5} B = 16 Output: (2 2 2 2 2 2 2 2) (2 2 2 2 2 6) (2 2 2 5 5) (2 2 5 7) (2 2 6 6) (2 7 7) (5 5 ...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1617731110, "func_sign": [ "static ArrayList<ArrayList<Integer>> combinationSum(ArrayList<Integer> A, int B)" ], "initial_code": "//Initial template for JAVA\n\nimport java.util.*;\nimport java.io.*;\nimport java.lang.*;\n\nclass Driverclass\n{\n stat...
{ "class_name": "Solution", "created_at_timestamp": 1617731110, "func_sign": [ "combinationalSum(self,A, B)" ], "initial_code": "# Initial Template for Python 3\n\nimport atexit\nimport io\nimport sys\n\n# Position this line where user code will be pasted.\nif __name__ == '__main__':\n test_cases = int...
eJzdfc2uLbluXoJ4kMfY6JEbuDB2UZRUlbnfwYDb8MC+Aw98cgd9AQdBgjxEHjh7VYnkR4qqtc5f9+mgcA6KlEr8p6i1VaX/8zf/8F/+63/+T//4P3/6t09/+euvP/23t5+2Xz5t9ePfG72VN36rb+2tv+1vx9v2/rZtbxu9beVt47dHJ3r/6U9vP/35P/7y53/59c//+s///a+/jkH+9qPjK9fPL3WkV7qV553olZH4WRd6Tqred6DnnNAzPsozLtpdMz2Tgu5lKPfs9XUjPZOe7mWne8npTu5yJxTfUd1XTXSvSrpTJN2pkdZKLHcq...
704,544
Check Tree Traversal
Given Preorder, Inorder and Postorder traversals of some tree of size N. The task is to check if they are all of the same tree or not. Examples: Input: N = 5 preorder[] = {1, 2, 4, 5, 3} inorder[] = {4, 2, 5, 1, 3} postorder[] = {4, 5, 2, 3, 1} Output: Yes Explanation: All of the above three traversals are of the ...
geeksforgeeks
Hard
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "static boolean checktree(int preorder[], int inorder[], int postorder[], int N)" ], "initial_code": "import java.util.*;\nimport java.lang.*;\nimport java.io.*;\n\nclass GFG\n{\n\tpublic static void main(String args[])\n\t{\n\...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "checktree(self, preorder, inorder, postorder, N)" ], "initial_code": "# Initial Template for Python 3\n\n# Driver Code\nif __name__ == \"__main__\":\n t = int(input())\n for _ in range(t):\n n = int(input())\n ...
eJytVM0KgkAQ7lDvMexZAt2fQw/RucjoUHvookIKQQQ9RL1Ht16vmd01U1RYVRadFb9vvplvx8f89VnMzLV5Y7C7sXOSFTlbAQvjpFosAKavmT7m+nRIi9x9s9WXOGH3AOq4CBGAtwhCE3Wg12kfuGTwS80NELiB2gfv5GgXYCi4y04UGHtSCKtCEFqAo6HAV4twWkCQjLAMhLci6fqCUGkrEkgnSzLpTyepPDAW/4W/JH62qbJhEtHK9kpS2+xG4lYNM7J+Frw5qtXnhvC1w0gbecjQA5jUhObkUXGTNksN7BaxkZrpmZt/KvdqyLCr...
712,176
Find XOR of numbers from L to R.
You are given two integers L and R, your task is to find the XOR of elements of the range [L, R]. Examples: Input: L = 4, R = 8 Output: 8 Explanation: 4 ^ 5 ^ 6 ^ 7 ^ 8 = 8 1<=l<=r<=10**9
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1664387363, "func_sign": [ "public static int findXOR(int l, int r)" ], "initial_code": "// Initial Template for Java\n\nimport java.io.*;\nimport java.util.*;\n\nclass GFG {\n public static void main(String[] args) throws IOException {\n Scann...
{ "class_name": "Solution", "created_at_timestamp": 1664516064, "func_sign": [ "findXOR(self, l, r)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n t = int(input())\n for _ in range(t):\n l, r = list(map(int, input().split()))\n ob = Solution()\n ...
eJyllE1KBDEQhV3oPULWg6QqP1XxJIItLrQXbtpZ9IAgiofQvTuvqYypDDI8ehzfpgsq85G8ejWvp++fZydbXX58F1dP/n5ab2Z/4TwNE4UmZ5X4lfPj43q8nce7m4fN3A6HYXoZJv+8cr8Jtal0QggAsTsAWLm1ybWKIIoAgjimXESrqyolp8iEEHYSkUyOTYhUMyVVYUBK3WSrEiD1PiCJOeRaRehOvQ9IanLtW5HV1keOR5NLJuRTIYmicPw2sWCzi+hO1ocp6EFainXP5EGRhHlMtSqL5IwudPR+0c8e/GdF9ycEAFwjhVhUF1Zi...
700,653
Triplet Family
Given an array arr of integers. Find whether three numbers are such that the sum of two elements equals the third element. Examples: Input: arr[] = [1, 2, 3, 4, 5] Output: true Explanation: The pair (1, 2) sums to 3. Input: arr[] = [5, 3, 4] Output: false Explanation: No triplets satisfy the condition. Constraint...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1618437728, "func_sign": [ "public boolean findTriplet(int[] arr)" ], "initial_code": "// Initial Template for Java\nimport java.io.*;\nimport java.lang.*;\nimport java.util.*;\n\n//Position this line where user code will be pasted.\n\nclass GFG {\n p...
{ "class_name": "Solution", "created_at_timestamp": 1618437728, "func_sign": [ "findTriplet(self, arr)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == \"__main__\":\n t = int(input())\n while t > 0:\n arr = list(map(int, input().split()))\n ob = Solution()\n ...
eJy1VMtKxEAQ9CB+R5HzIj3PzHr05h8IRkQ0giBx0SwIovgR+r9WT7LqCis6WQPdPQSmpqqrZ1523472dvJ3fMjFyWN13S2WfXWAyjSdEYERA8twXHvWIFLNULUPi/aiby/Pbpf9uKG/W7ZN99x01dMM34Bg4ZFgIpxF9DA2wYa4Aenq/OZ+E1QQUkBmxmpZLauyc6GA2RyGTGq4CB8QPKJDbZEM5gVoJAWHSHpkB0vZaYUcCromkhVmedp9Ue1MUVOtKWmaS5EnNNOI5QGO4XlGYJCs1Iz0d0ClNhBU4KEM/1TDYNRKTAlhdZ1Q3E9+...
702,726
Large Factorial
You are given an array A of integersof length N. You need to calculatefactorial of each number.The answer can be very large, so print it modulo 10**9+ 7. Examples: Input: N = 5 A[] = {0, 1, 2, 3, 4} Output: 1 1 2 6 24 Explanation: Factorial of 0 is 1, factorial of 1 is 1,factorial of 2is 2, factorial of 3is 6 and ...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1617950236, "func_sign": [ "public long[] factorial(long a[], int n)" ], "initial_code": "// Initial Template for Java\n\nimport java.io.*;\nimport java.util.*;\n\nclass Main {\n // Driver code\n public static void main(String[] args) throws Except...
{ "class_name": "Solution", "created_at_timestamp": 1617950236, "func_sign": [ "factorial(self,a, n)" ], "initial_code": "# Initial Template for Python 3\n\n# Driver code\nif __name__ == \"__main__\":\n tc = int(input())\n while tc > 0:\n n = int(input())\n a = list(map(int, input().st...
eJzNVctuFDEQ5MCFv2jNOULul7vNlyCxiAPsgcuSQyIhIRB3bgj+l/LMbAZFcRZIgLQ0nl573I+qsvfz4+9fnzya7fkXOC8+TG8P55cX0zOaeHfg0h8YtW7ks88kpGTkVCmmM5r278/3ry/2b169u7xYN7ty8xKSlDU4zRPfajT1VJ8jVBIjlkKBx4sV2h0+7Q7TxzO6VoTjETUnNxXupRCKWErBgJmM6tQXMdONpBtpN7Ju5N2odqPoNio8mjeJYMRrVjylUXitxia98K0xbdzUMtFHCNaRkLE1Uxl5gtEsC1lND63RqwnRsHRqKlYs...
705,612
Rohan's Love for Matrix
Rohan has a special love for matrices especially for the first element of the matrix. Being good at Mathematics, he also loves to solve the different problems on matrices. So one day he started to multiplythe matrix with theoriginal matrix. The elements of theoriginal matrixaare given by[a00=1, a01=1, a10=1, a11=0].Giv...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "static int firstElement(int n)" ], "initial_code": "// Initial Template for Java\nimport java.io.*;\nimport java.util.*;\n\nclass GFG {\n public static void main(String args[]) throws IOException {\n BufferedReader r...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "firstElement(self, n)" ], "initial_code": "# Initial Template for Python 3\nif __name__ == '__main__':\n t = int(input())\n for _ in range(t):\n n = int(input())\n\n ob = Solution()\n print(ob.firstE...
eJytlb1OAzEMxxmQeAU2qpsrZCdOYvMkSAQxQAeWwFAkJATiIeB9cX1tuauSlgM83J2H/Pzxt3Pvx59nJ0dml6f6cfXS3ZfHp2V3Met8LghmuYhZLmzWzWfd4vlxcbtc3N08PC3XBwQZBF2MubzlEjF6EAIyj5FCiJC8ed3rfDaIhLkkswY4hMROAdXDLpdgpiHNGhDvETh56CHMCIkpSQ2pKE1JwdsWaAx7N9holP7p7CmI5EOA3vPaixgTcKN6bIFXVdVP7M2kFmFf/mPldk77b/m389AKPxZ9jK2m5tZw3gRpqQeYGDm6ymztIGmQ...
714,082
Taxi Booking
You are going to book a taxi. There are infinite number of points 1, 2, 3... on the X axis and your current position is cur. There are N Taxis near you, and the position of those taxis is given as an array pos. Where pos[i] denotes the position of the ith taxi. You are also given an array time. Where time[i] denotes th...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1676973232, "func_sign": [ "public static int minimumTime(int N, int cur, int[] pos, int[] time)" ], "initial_code": "import java.io.*;\nimport java.util.*;\nclass IntArray\n{\n public static int[] input(BufferedReader br, int n) throws IOException\n ...
{ "class_name": "Solution", "created_at_timestamp": 1676973232, "func_sign": [ "minimumTime(self, N : int, cur : int, pos : List[int], time : List[int]) -> int" ], "initial_code": "class IntArray:\n def __init__(self) -> None:\n pass\n\n def Input(self, n):\n arr = [int(i) for i in inp...
eJzNVctKxDAUdSH4G5esB8mzbfwSwYoL7cJNnUUHBkTxI/Sz3PlB5t5kJpX2dtphhCnlNg3NOafn3JCPy6+fqwu6br/D4O5VPLfrTSduQKi6NXXrpKxbJaUEjcXI4btYgWi26+axa54eXjZdWh9W0sfvdSveVvAX2UUQAoM4Gn0kLu89TeTCkHJ8CpG0sTteUh/lS7BUSS8UVEuqFVU/lLOkMEJRC29PQcYPrSappDQLAg0GLLgww3BZzzPZwFSUlScmJEIepMEJ8FBByaAab0ttGNgqLHf9eJPh2mXbjcvmJzNc4t9psTERzAPTOKbT...
703,882
Copy Set Bits in Range
Given two numbers X and Y, and a range [L, R] where 1 <= L <= R <= 32. You have to copy the set bits of 'Y' in the range L to R in 'X'.Return this modified X. Examples: Input: X = 44, Y = 3 L = 1, R = 5 Output: 47 Explanation: Binary represenation of 44 and 3 is 1011 00 and 0000 11 . So in the range 1 to 5 there a...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "static int setSetBit(int x, int y, int l, int r)" ], "initial_code": "//Initial Template for Java\nimport java.io.*;\nimport java.util.*;\n\nclass GFG{\n public static void main(String args[])throws IOException{\n Bu...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "setSetBit(self, x, y, l, r)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n t = int(input())\n\n for _ in range(t):\n arr = input().split()\n x = int(arr[0])\n y ...
eJytlM9KAzEQxj2IzzHsucj8zSQ+gzcvghUP2oOXtYctCKL4EPq+ZtvuFqHJbsW5ZBeSHzPf9yWf5983F2fbur3OH3dvzXO73nTNFTS0bIlFLXhMkKIHU2ECQmBcts0CmtXrevXYrZ4eXjbdcIjF2Ylt2X7kTe8L+E3cMhB6JhIYkBVRph5FCxwaCngoIBAu0jgoKxFKAZiGgsPQjCCVUdFJUCh4AamcNAXnBNFiSpma4QZcHlmFnDVZqcljflQ17A8EI6XS1AdbR3RVxn7oICnFNEncLfkfInCsEk0xWElGJnWNEtRz9lxcKbLkfqtu...
703,278
String formation from substring
Given a string s, the task is to check if it can be constructed by taking a substring of it and appending multiple copies of the substring together. Examples: Input: s = "ababab" Output: 1 Explanation: It is constructed by appending "ab" 3 times Input: s = "ababac" Output: 0 Explanation: Not possible to construct...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "int isRepeat(String s)" ], "initial_code": "//Initial Template for Java\n\nimport java.io.*;\nimport java.util.*;\n\nclass GFG {\n public static void main(String args[]) throws IOException {\n BufferedReader read =\n...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "isRepeat(self, s)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n T = int(input())\n\n for i in range(T):\n s = input()\n\n ob = Solution()\n answer = ob.isRepeat...
eJxrYJl6lJUBDCL2ARnR1UqZeQWlJUpWCkqGMXmJSclwFJOnpKOglFpRkJpckpoSn19aglBXB5Ss1VFA0wwESVCMU7MBDs0VlVVwVFlFsvbC8tSikkpkkmTnV+EFpIdGEhziDkrcoYEBSTYjJz8vvbikKDMvHRuLjNhNSoJhkjUXpRakJpbgIkk2DhEsMTFAEiXRkhpMqNGMHkhUiDlg1MVQYAjZ8V9RCcmTGGkRKZNSnsowUgb2ZEd2hiaYnYksUEiNAkhhhsUcMss3sC+IyAmkeDl2ih4A4VIVcQ==
712,069
Maximum Nesting Depth of the Parentheses
A string is a valid parentheses string (denoted VPS ) if is meets any one of the following: It is an empty string "", or a single character not equals to "(" or ")" , It can be written as AB (A concatenated with B ). We can similarly define the nesting depth depth (S) of any VPS S as follows: depth ("") = 0 depth (C)...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1663911489, "func_sign": [ "public static int maxDepth(String s)" ], "initial_code": "import java.io.*;\nimport java.util.*;\n\nclass GFG {\n public static void main(String[] args) throws IOException {\n Scanner sc=new Scanner(System.in);\n ...
{ "class_name": "Solution", "created_at_timestamp": 1663739167, "func_sign": [ "maxDepth(self, s)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n t = int(input())\n\n for _ in range(t):\n s = input()\n ob = Solution()\n print(ob.maxDepth(s))\...
eJy9VdtOwkAQ9cHE32j6NLPDuhRaCv6FbyRAjEIFpBZU7gTjR+j/OtsCIdHdconOQzttsmfOzDmdflx+1a8u0qjfctJYuf1kNBm7N47rNRMHwKOSgLIEXwXIQaCjolOAkK9uwXGj+Shqj6PO3XAy3hwOmsl7M3HXBecHIuij6fk01dkmN6L5FjSAe3pgXm3qaHoRPWY0u9RDAX16OolkA1ZrbCE2QCcraLSQnw04ZQu9OS2YxlJTmgmY0DRjNxAx355lYiRnA82CpUFZRuEja0MVlCGKKqoaUtEEWjODajQBUFY+UoASKgQhw6V4m4JF...
713,978
Update Queries
You are given an array of n elements, initially all a[i] = 0. Qqueries need to be performed. Each query contains three integers l, r, and x and you need to change all a[i] to (a[i] | x) for all l≤i ≤ r. Examples: Input: N=3, Q=2 U=[[1, 3, 1], [1, 3, 2]] Output: a[]={3,3,3} Explanation: Initially, all elements of t...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1675772979, "func_sign": [ "int [] updateQuery(int N, int Q, int [][]U)" ], "initial_code": "//Initial Template for Java\n\nimport java.util.*;\nimport java.io.*;\nimport java.lang.*;\n\nclass GFG{\n\tpublic static void main(String [] args) throws IOExce...
{ "class_name": "Solution", "created_at_timestamp": 1675772979, "func_sign": [ "updateQuery(self, N, Q, U)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == \"__main__\":\n for _ in range(int(input())):\n n, q = map(int, input().split())\n U = []\n for i in ran...
eJzdVEtOwzAQZcGCY4y8rlDGnzjtSZAwYgFZsDFdpBISAvUQcB123AuP7URtw7gUogo1M6pcd/pm8vz81ufvnxdn8bn6CIvrZ/Hgl6tOLECg8wjpA7Cix3kxA9E+Ldu7rr2/fVx1ubQC51/Dry8z2AYwCcCAkra27P8VwmYyYFiBiuNUPap0vqavmkeGPswQLHzGzQsGMdJxAsGwoDLHxIAECWlrLx9lNDUIiFuzwqJgwCWdf1ZnGlYWoDQ0BWGZNE4Qkg4KaUhXFjDsNqQvS/BzehcW3FI9xjSUNgY3eW5IjYkIDJODNPG+mNgWa+iL...
700,533
Maximum Bipartite Matching
There are M job applicants and N jobs. Each applicant has a subset of jobs that he/she is interseted in. Each job opening can only accept one applicant and a job applicant can be appointed for only one job. Given a matrix G where G(i,j) denotes i**thapplicant is interested in j**thjob. Find an assignment of jobs to app...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "public int maximumMatch(int[][] G)" ], "initial_code": "//Initial Template for Java\n\nimport java.util.*;\nimport java.lang.*;\nimport java.io.*;\nclass GFG\n{\n public static void main(String[] args) throws IOException\n ...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "maximumMatch(self, G)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n T = int(input())\n for i in range(T):\n m, n = map(int, input().strip().split())\n G = []\n ...
eJztWMFKxDAQ9eBPeBCG4HGRJN1li18iWPGgPXiJe+iCIIIfof9rOk27STOztHahu24WsqTpZOa9l2baydflz83VBf7ur23n4UO8ms22EncgssKsYFUYBRKwFcZ1QLaj2G1G0cCzXcKyvsZbtQ2adxadr8KsYe35CP2Etn4UD4oD0oYi7nYDYgGifN+Uz1X58vS2rRxVy9KCtTDE5wI8CXRh8p0EFFnHqoUgebm6aXLnTNleH3E4ORju6RKFoSwDWcMghKUHMhqOLXtr0zVe5ZptT2OFMuStRIHU+9bdl51gTWsT6RLhj1hGFgy7nGKm...
710,025
Levels Of Game
You are playing a game. At each level of the game, you have to choose one of the roads to go to the next level. Initially, you have h amount of health and mamount of money.If you take the first road then health decreases by 20 and money increase by 5.If you take the second road then your health decreases by 5 and money...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1650389561, "func_sign": [ "public static int maxLevel(int h,int m)" ], "initial_code": "import java.io.*;\nimport java.util.*;\nclass IntArray\n{\n public static int[] input(BufferedReader br, int n) throws IOException\n {\n String[] s = br...
{ "class_name": "Solution", "created_at_timestamp": 1650389561, "func_sign": [ "maxLevel(self, h:int,m:int) -> int" ], "initial_code": "class IntArray:\n def __init__(self) -> None:\n pass\n\n def Input(self, n):\n arr = [int(i) for i in input().strip().split()] # array input\n ...
eJylkj8KwjAUxh16kEfmKnlJQxtPIlhx0AwusUMLgigeQg/g5jF9OigOnzY1EAiEX74/L6fscstGzzW7ymG+V5vYdK2akuI6MrHKSYVdE1ZtWC+3Xfu+PNZRHXL6JCqtSTagLHvAOWIIAcRocgBxAGFxZ6A7VwKs9J5kJ4eyBBlk0JFF9pC7QkLB8io0KNZUwCZQIGbNWMvAIr4YHCODUt5DUT6TiP7UhoWK9GuACIYdDRAEtvGvS3+ob6xeL6fCmoZPkv+OsjhP7rQkZro=
701,151
First Set Bit
Given an integerN. The task is to return the position of first set bit found from the right side in the binary representation of the number.Note: If there is no set bit in the integer N, then return 0 from the function. Examples: Input: N = 18 Output: 2 Explanation: Binary representation of 18 is 010010,the first se...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1618483437, "func_sign": [ "public static int getFirstSetBit(int n)" ], "initial_code": "//Initial Template for Java\n\nimport java.util.*;\nimport java.lang.*;\nimport java.io.*;\n\nclass Main {\n \n \n\tpublic static void main (String[] args) {\n...
{ "class_name": "Solution", "created_at_timestamp": 1618483437, "func_sign": [ "getFirstSetBit(self,n)" ], "initial_code": "# Initial Template for Python 3\n\nimport math\n\n# Position this line where user code will be pasted.\n\n\ndef main():\n T = int(input())\n\n while T > 0:\n n = int(inp...
eJytlE0KwjAQhV30ICXrIvmbZOpJBCsutAs30UUFQRQPoVt33tNUqyj0BRSzCm2/eXlvJj1m52s2uK/xJW4mO7EM600jRrlQVZCiyEW9Xdfzpl7MVpumeyWrcKiC2Bf55/dKWibvAKUVwIwhstZoxDnAOa8ks7OI84Aj49jLUiFBA/0Zq5X3mpEiw2C6BcCyj9NV0EQRBtAjzt5QI6q0seQ8x9Ile0cx3x8KxYfasTUUayHTvYd/pdWOEU4sIRo1kWI65RcO40aqj/n9FmodJgcfm6RvXd4b+6/OdvfnfT7RYdJ9Svwq8Hi+u0jCzyCm...
700,408
Rat in a Maze Problem - I
Consider a rat placed at (0, 0) in a square matrix mat of order n* n. It has to reach the destination at (n - 1, n - 1). Find all possible paths that the rat can take to reach from source to destination. The directions in which the rat can move are 'U'(up), 'D'(down), 'L' (left), 'R' (right). Value 0 at a cell in the m...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "public ArrayList<String> findPath(int[][] mat)" ], "initial_code": "// Initial Template for Java\n\nimport java.util.*;\n\nclass Rat {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);...
{ "class_name": "Solution", "created_at_timestamp": 1722276232, "func_sign": [ "findPath(self, m: List[List[int]]) -> List[str]" ], "initial_code": "# Main function to read input and output the results\nif __name__ == \"__main__\":\n t = int(input().strip())\n for _ in range(t):\n n = int(inp...
eJzVVDsOwjAMZWDjElHmgpyBhbkjUyckghigA0vo0EpIfMQh4L4kaUPVTz5tANGkUi0r8vPzs30fPy+TkTyrjBvrMz6wJEvxAmFC2ZwygvILlAESV5rSI/zCLPzlW4IDhONTEu/SeL89ZmkRMYqiMOQfZTfK8DVArWgyXAUCql6ivAWwBk0gCUTE/9Iww9ajVryKJDiR5IBLfiRqZEJtBrUloCcrYd04tgA35TVxzOsZGrnpGwQUzXc6hdeAFnroB530mxK7YqSlcHXFbO1pxnEfA3tndBgDKEUjqhmg1xjY6HXeKZ9fEG7rSJ8oDCpT...
705,695
Assignment Problem
You are the head of a firm and you have to assign jobs to people. You have N persons working under you and you have N jobs that are to be done by these persons. Each person has to do exactly one job and each job has to be done by exactly one person. Each person has his own capability (in terms of time taken) to do any ...
geeksforgeeks
Hard
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "static int assignmentProblem(int Arr[], int N)" ], "initial_code": "//Initial Template for Java\n\nimport java.io.*;\nimport java.util.*;\n\nclass GFG {\n public static void main(String args[]) throws IOException {\n ...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "assignmentProblem(self, Arr, N)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n t = int(input())\n for _ in range(t):\n N = int(input())\n Arr = list(map(int, input().sp...
eJzdVztuFEEUJCDmDE8bW2he9+sfJ0FiEQE4IBkIbAkJgTgEXJGMO1BVjSUTNDYWoDWrCVarUb/6vZrZTw+/fHv0QJ+nX/Hl2fvD6/3t5cXhiR38uMdx78l6tjpsJPNiKVlNNsIcV7biVqsNt9KtZvx+OLPD+bu35y8vzl+9eHN5cXVWz8f943E/fDizn0eU4z6K5c1is7pZCcvJUljD3GE1LDBls96sFQLA9O6WhvVuoxMG7vHKm0taTY+0mF6PO47FUBwFFgGCmTDAOsCoWAewai7uYJ0z1WgA0K1xokWTIG5jWG5WgLZY23gnRas8...
712,035
Pattern 17
Geek is very fond of patterns. Once, his teacher gave him a pattern to solve. He gave Geekan integer n and asked him to build a pattern. Examples: Input: 4 Output: A ABA ABCBA ABCDCBA Constraints:1<= N <= 20
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1662630677, "func_sign": [ "void printTriangle(int n)" ], "initial_code": "import java.io.*;\nimport java.util.*;\n\nclass Main {\n // Driver code\n public static void main(String[] args) throws Exception {\n BufferedReader br =\n new Buff...
{ "class_name": "Solution", "created_at_timestamp": 1663316956, "func_sign": [ "printTriangle(self, N)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n t = int(input())\n\n for _ in range(t):\n N = int(input().strip())\n ob = Solution()\n ob.p...
eJztndmSG0kVhrmAG55CoWsHoX3xnYdhGIZ9H5gajFYwi9xAFxiMHTwE78UroXYvOiplVmaVasuTX0XYPq3NdTL///sldVXlf776+f++/rWvfPG2/+pwk972n/f60+QwTA6j5DBODpPkcPyx/6zX37252W1ud9uXr9Pbhwe+SA7vk0Pv+M+Ljx7qux96H3568dE3n278cOv9zb2H24//fCwecP+Ih4c8Pqb39KC74ltPj++/e9YT+3vczeHg+Oe4o6OBdWd7j9v9/3RffnT64fH/fPzh49OP4n9/+vGT0w33P3/7dMvDDZ+ebnq85Tun...
705,437
Area of intersection of two circles
Given the coordinates of the centres of two circles (X1, Y1) and (X2, Y2) as well as the radii of the respective circles R1 and R2.Find the floor of the area of their intersection.Note:Use the value of Pi as 3.14 Examples: Input: X1=0,Y1=0,R1=4 X2=6,Y2=0,R2=4 Output: 7 Explanation: The intersecting area equals 7.252...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "long intersectionArea(double X1, double Y1, double R1, double X2, double Y2,\ndouble R2)" ], "initial_code": "// Initial Template for Java\n\nimport java.io.*;\nimport java.util.*;\n\nclass GFG {\n public static void main(S...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "intersectionArea(self,X1,Y1,R1,X2,Y2,R2)" ], "initial_code": "# Initial Template for Python 3\n\nimport math\n\nif __name__ == '__main__':\n t = int(input())\n for _ in range(t):\n X1, Y1, R1, X2, Y2, R2 = map(int...
eJzdVUtOwzAQZcGKU1hZN2jGn7HNSZAIYgFZsAldtBISAnEIuCE7LoGbr5PYiamQQLhVOrXHM/PefPJ6+v55dlKvyw8nXD1l99V2v8suWMaLChgwhG6N/wxio6f6E+Vd6OVsw7LycVve7sq7m4f9rnWCnBtBlqwhMFqRFlRUL0UlQIPlkktSHI1FI+vt7HnD5iHabnmSt9viaD5rcRAqDqglmNohRNzmHhN5kJVV0RkZmPJETznE6RqjTcScrJWImhyH5NgL4sAxDl9kMXyLXif2xayCQplyUayytk53UkrqaBYRQDzrcqnO5VBsrT/G...
703,911
Factorial Number
For a given number N, findwhether it is a factorial number or not.A Factorial number is a number which is equal to the factorial value of other numbers. Examples: Input: N = 6 Output: 1 Explanation: 6 is factorial of 3 Input: N = 5 Output: 0 Explanation: no number's factorial is 5. Constraints: 1 <= N <= 100000
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "static int isFactorial(int N)" ], "initial_code": "//Initial Template for Java\n\nimport java.io.*;\nimport java.util.*;\n\nclass GFG\n{\n public static void main(String args[])throws IOException\n {\n BufferedRea...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "isFactorial(self, N)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n t = int(input())\n for _ in range(t):\n N = int(input())\n\n ob = Solution()\n print(ob.isFac...
eJxrYJnazcIABhEtQEZ0tVJmXkFpiZKVgpJhTJ6hko6CUmpFQWpySWpKfH5pCUKqLiZPqVZHAVW9kQmJGgyNDEjUYY5DvQEO9cZmRhYWBqTaAtGFy/s47bK0NDQjwzKINlJtMyLRGhNzSwMDQzOSnWdkQnaww3WT7De4EeYIM8hxh7mlMSyEDUgPYjTd5PoGhAxJzUsQuw1BGN0BYHES3WBiDs5t+JMAvuiAhgVF4WBoaGRIyO7YKXoAZ2dmbw==
702,672
Number of matches
In a knockout tournament, there are n players, each with a unique rating represented by an array arr[]. In each round: - The 1st player plays against the 2nd player, the 3rd player plays against the 4th, and so on. - The player with the higher rating wins the match and moves to the next round. - If there is an odd n...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1617361068, "func_sign": [ "public static int[] getAnswer(int arr[])" ], "initial_code": "// Initial Template for Java\n\n/*package whatever //do not write package name here */\n\nimport java.io.*;\nimport java.lang.*;\nimport java.util.*;\n\nclass GFG {...
{ "class_name": "Solution", "created_at_timestamp": 1617361068, "func_sign": [ "getAnswer(self, arr, answer)" ], "initial_code": "# Initial Template for Python 3\ndef main():\n T = int(input())\n\n while T > 0:\n arr = [int(x) for x in input().strip().split()]\n n = len(arr)\n\n ...
eJy1VUFOhEAQ9GDiC7x5qHDemB6GgcaXmIjxoBy84B7YxMRofIT+155pSXCzPQsa51IQpoueqmp4P/28ODtJ6/pcLm5eisdhuxuLKxSuG1yxQdE/b/v7sX+4e9qN34+oG966oXjdYG8/pQUy6hycWYmS4AkVIRBqQkNgQksQUpOuhIOHYhXxSGNtWgqs0CjUCkGhUvAKpYKlRoWfjZTmKVswGtQI0qxPe62jLecMFEWL2kUJc3JNXKYH8tRLZ0E6bKTTVrjgZL8USa20FOBquAaO4Vp523JfZvdhuv9XrxSUhZWFlYWVhZWFlYWVhZWF...
701,192
Smallest Positive Missing Number
You are given an integer arrayarr[]. Your task is to find the smallest positive numbermissing from the array. Examples: Input: arr[] = [1, 2, 3, 4, 5] Output: 6 Explanation: Smallest positive missing number is 6. Input: arr[] = [0, -10, 1, 3, -20] Output: 2 Explanation: Smallest positive missing number is 2. Con...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1731130209, "func_sign": [ "public int missingNumber(int[] arr)" ], "initial_code": "import java.io.*;\nimport java.util.*;\n\npublic class Main {\n public static void main(String[] args) throws IOException {\n BufferedReader br = new BufferedR...
{ "class_name": "Solution", "created_at_timestamp": 1731130209, "func_sign": [ "missingNumber(self,arr)" ], "initial_code": "# Initial Template for Python 3\n\nimport math\n\n\ndef main():\n T = int(input())\n while T > 0:\n arr = [int(x) for x in input().strip().split()]\n ob = Soluti...
eJytkz1OA0EMhSngHk9Tx8ie/6Gk4wZIgChgC5okxUZCQkgcAu7LZHcDSjKDMivGxW5hf7afnj/Ov24uzoZ3e51/7t7Uy3K96dUVlNwvhaEZhmEZjuEZgREZiSHMagHVva67p757flxt+t869b7APokEpEEGZEEO5EEBFEEJJE0kgc5hYHO4HB6+Uh5K5Q4BESnPDxGIhhiIhbiWGXLtMMO2+w5XqbfFHXh4SMMbP3Fi2pFawcWyuBPvMKRC0WVhf5qXFYJ4SIDkSVP2RQtbN7Kha6OX3eXG/cnudNjTErECSyer2eb1idBka8b/3VpL...
702,995
Stuffs Division
You are given an array arr[] where each element represents the amount of goodies currently held by students. Each student at index ishould receive exactly iamount of goodies (1-based indexing) for a fair distribution, with no wastage allowed. Your task is to determine whether it is possible to redistribute the goodies ...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "public boolean possible(int[] arr)" ], "initial_code": "// Initial Template for Java\nimport java.io.*;\nimport java.lang.*;\nimport java.util.*;\n\n//Position this line where user code will be pasted.\n\nclass GFG {\n publ...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "possible(self, arr)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == \"__main__\":\n t = int(input())\n while t > 0:\n arr = list(map(int, input().split()))\n ob = Solution()\n ...
eJztVMFKxDAU9ODBmzfPQ87L0iR9aeuXCFZEtIIgdXFbEETxI/R/ne3roSzboukueDAPOqVJXt+bmeTj+Ovs5KgbF6d8uXw1D/Wqbcw5jC1rm3QD//gn0CxgqpdVddtUd9dPbdMLdX/zuK7K+r2szdsCWwrCwSOFICBDjoK5RtI0z+1YlqIbsNsRUZBDHxF7RdmQaDJ6Ovt2umeukCkEBVFIFbyCU4hpWrAjotT01NHSEAJHaXP4gJS5KC/1ZS8UJRFYxyWcsuJhM34rEq6Po4yWyWmdwJJT/t6Nqj7hH6+8u6Gb99u+hM38gTj4fcM/...
702,811
Mr Modulo and Pairs
Mr. Modulo comes up with another problem related to modulo and this time he has an array of integers arr[] and an integer k, he is interested in finding all the possible pairs arr[i] and arr[j] in the array arr[] such that arr[i] % arr[j] = k. The array given will have distinct elements.You are required to return the n...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "public int printPairs(List<Integer> arr, int k)" ], "initial_code": "// Initial Template for Java\n\n// Initial Template for Java\n\nimport java.io.*;\nimport java.util.*;\n\n//Position this line where user code will be pasted...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "printPairs(self, arr, k)" ], "initial_code": "def main():\n t = int(input())\n for _ in range(t):\n arr = list(map(int, input().strip().split()))\n k = int(input())\n ob = Solution()\n print(o...
eJy9lLFOwzAQhhkYeIxfmSsU27GdsLDxDEgEMUAGltAhlSohEA8B74vz34WpVknT9ob/2sT13/vO56/Ln7urC8b9bfrw8F689uvNUNygMG1vSgYkG80WDUNSDZsWFisU3XbdPQ/dy9PbZtA9Qtt/tn3xscLujb2kyAwryTAjSEqrZVXGwuUsrKt8ADWCWoPagJocRjWgWlAdqBVtx/e5ysqMLZE4oolCKBomL9+8vHPy0DYjvTjTY6KnbagZiAwEBjwDFQOOAcsYazOMjK+xueLqGHwFqgPVgmpALUFtQE1HY9QIahh9+Zu5THfVG6Xe...
704,213
Perfect Sum Problem
Given an array arr of size nof non-negative integers and an integer sum, the task is to countall subsets of the given array with a sum equal to a given sum. Examples: Input: n = 6, arr = [5, 2, 3, 10, 6, 8], sum = 10 Output: 3 Explanation: {5, 2, 3}, {2, 8}, {10} are possible subsets. Input: n = 5, arr = [2, 5, 1, 4...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1619006521, "func_sign": [ "public int perfectSum(int arr[],int n, int sum)" ], "initial_code": "//Initial Template for Java\n\nimport java.io.*;\nimport java.util.*;\nclass GfG\n{\n public static void main(String args[])\n {\n Scanner sc = n...
{ "class_name": "Solution", "created_at_timestamp": 1619006521, "func_sign": [ "perfectSum(self, arr, n, sum)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n T = int(input())\n for i in range(T):\n n, sum = input().split()\n n, sum = int(n), int(sum...
eJytVEFOwzAQ5FBx4ROrnCu069ixw0uQCOIAOXAJPaRSJVSJR8B/mTWpVBo7cqsmTpTYszPjiZ2v1c/d7U08Hld4ePqs3ofNdqweqDLdIEyGu8HR7MSYI2EMehJLNUkAlFoy6PZk8AZYS4IR7emGak1Vv9v0r2P/9vKxHQ8qAg5rLAD7NR3JSzeA0PHkgmomq+/UMHmmADFWBySQqslCriFPQUU5KyfWp5Tg0bvjiQpPzcSmc4jNaMuz+7ZN0SONAJH/RrMsTTKLGHdBGmpbHQMhVp3jAkiAEsCk1XpcyqOTA84AZ1w+tJZDCMnYCEX5...
713,589
Balloon Everywhere
Bob is very fond of balloons. Once he visited an amusement park with his mother. The mother told Bob that she would buy him a balloon only if he answer her problem right. She gave Bob a stringS [contains only lowercase characters]and asked him to use the characters of string to formas many instances of the word "balloo...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1673953354, "func_sign": [ "public int maxInstance(String s)" ], "initial_code": "// Initial Template for Java\n\nimport java.util.*;\nimport java.lang.*;\nimport java.io.*;\n\n// Position this line where user code will be pasted.\n\nclass GFG {\n pub...
{ "class_name": "Solution", "created_at_timestamp": 1673953354, "func_sign": [ "maxInstance(self, s : str) -> int" ], "initial_code": "if __name__ == \"__main__\":\n t = int(input())\n for _ in range(t):\n s = input()\n obj = Solution()\n res = obj.maxInstance(s)\n print(...
eJyllElOwzAUhlm094i8rirSdsVJkDCq7MQd6MMv0ARSEIhD0NN015PVQ9uERE5kk0XyMrzh+/07P4P9cXhjjvuDCh4+yVpmRU7uIhJTyTljAIhSUklGERFlJpJcpHMs8uqrb/XyaxQ1UhmU5gTO1FtHqkQEANWasZC2ng0nGtM0A42Kmlbhamo9vi6Yqbh53zPZzD1fR65LEUA1oWTYweYSpPRuxniSisVytX7awLPE7OV1mxdv7+Xuw7sUt+75e3FWmfZbicYWyVvAUC9yuwvi6za4VPqPx4yfWoailT26FXJCWqG8xfG3SEsVSoN0...
700,353
Interleaved Strings
Given strings A, B, and C, find whether C is formed by an interleaving of Aand B. Examples: Input: A = YX, B = X, C =XXY Output: 0 Explanation: XXY is not interleaving of YX and X. Input: A = XY, B = X, C = XXY Output: 1 Explanation: XXY is interleaving of XY and X. Constraints: 1 ≤ length of A, B ≤ 300 1 ≤ leng...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1617123739, "func_sign": [ "public boolean isInterLeave(String a,String b,String c)" ], "initial_code": "//initial code\nimport java.util.*;\nimport java.lang.*;\nclass InterLeaveString\n{\n public static void main(String[] args)\n {\n Scann...
{ "class_name": "Solution", "created_at_timestamp": 1641055290, "func_sign": [ "isInterleave(self, A, B, C)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n t = int(input())\n for i in range(t):\n arr = input().strip().split()\n if Solution().isInter...
eJzVVc1OwzAM5sCBx7ByntAKN25xuvGzjf9BAgUO0AOXsEMnISEQDwHvi5OwKKvabilDCLd1G7exv3x23Pf1z3xjzYq8pYfrF/aoJ9OC7QDbzjRH4AI4CjppZJ6tiTQ3BhQpOMURhUhT1gGWP0/y+yJ/uHuaFt+uupl+y7TTidXstQNBrC3nrNff3ds/gMFwdHh0fHJ6dj4GPsDhSNDQvDQm+mBssJiAMLsRHIuSBjUQkgBCRXAvgF6s9/KVaekFlBeQSkkVKqnikSQhDY4FsDRcXEp1VfmqbKz/vDE3FUCADt64hir0gNykIzoYsY2x...
705,151
Row with minimum number of 1's
Given a 2D binary matrix(1-based indexed) a of dimensions nxm , determine the row that contains the minimum number of 1's.Note: The matrix contains only 1's and 0's. Also, if two or more rows contain the minimum number of 1's, the answer is the lowest of those indices. Examples: Input: n = 4,m = 4 a = [[1, 1, 1, 1], ...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1729917875, "func_sign": [ "int minRow(int mat[][])" ], "initial_code": "// Initial Template for Java\n\nimport java.io.*;\nimport java.util.*;\n\nclass GFG {\n public static void main(String args[]) throws IOException {\n BufferedReader read =...
{ "class_name": "Solution", "created_at_timestamp": 1729917875, "func_sign": [ "minRow(self,a)" ], "initial_code": "# Initial Template for Python 3\n\nimport math\n\nif __name__ == '__main__':\n t = int(input())\n for _ in range(t):\n N, M = map(int, input().strip().split(\" \"))\n mat...
eJydVMtOwzAQ5FCJ31j5XCFvHqXqlyBRxIHmwCX0kEoIREX/ofwvfsTrdxOnqVLH3pn1jCf9Xf1d7u/U5+lLDJ6/2Xt/PA1sB6zd9xvY7HsEuuwDBy4fuLmCFe6uyB8ieITWAFEvohniOEQD8alsP/RmW8loOjgbwQCLLtYoECPuSUyAUypJqxUYVFrVWTgpxBieqUxuKTG5ha3dArkWULqtMazgyZZ+u9GnKQhbA+s+j93b0B1eP06DDdhZHJ+61+peOTPsZw1OGkVBo6PjnWPolpetGhqqSg1aG+8gJXGIo2OcUqe1oKMuUKTdFm2y...
712,680
Unique Binary Tree Requirements
Geek wants to know the traversals required to construct a unique binary tree.Given a pair of traversal, return true if it is possible to construct unique binary tree from the given traversals otherwise return false. Examples: Input: a = 1, b=2 Output: 1 Explanation: We can construct binary tree using inorder travers...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1668490265, "func_sign": [ "public static boolean isPossible(int a, int b)" ], "initial_code": "//Initial Template for Java\n\nimport java.util.*;\nimport java.lang.*;\nimport java.math.*;\nimport java.io.*;\n\nclass GFG {\n public static void main(St...
{ "class_name": "Solution", "created_at_timestamp": 1668490581, "func_sign": [ "isPossible(self, a, b)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == \"__main__\":\n t = int(input())\n for _ in range(0, t):\n a, b = input().split()\n a = int(a)\n b = int(...
eJy1VctOwzAQ5MCBT+iNlc8Vil9p6ZcgYcQBcuBiekilSlURH9H+L/bGStrSddeE5mAlSjI7OzNef9/u7+9u8HqahJvnjfjwy1UrFiC08wqk8xqU8xasmIJo1svmrW3eXz9XbfosfPHlfLdWuIrtFA5wbHgbIQYwBQHbQM1AvIhuEhwCG7CRKge4oiFVJIy4VM+Zn+u+WyQlU98mAmrQbGYXWc4OZR0k0ElbrmWUJlRzQyUZC0vAmGBhWSh7ptBRZkxnhioTMIM+T8Cy7yUlsktPL6LJFqsY+p0tL6tevN/+JRKh4zoymUHweQ6P2SDy...
702,832
Strange Sort
Given an array arr[] of non-negative integers. Sort the array in ascending order such that the element at the Kth position in the unsorted array stays unmoved and all other elements are sorted. Examples: Input: arr[] = [3, 12, 30, 79, 2] , k=2 Output: [2, 12, 3, 30, 79] Explanation: The element at the 2nd position (1...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "void strangeSort(int[] arr, int k)" ], "initial_code": "// Initial Template for Java\n\nimport java.io.*;\nimport java.util.*;\n\npublic class Main {\n\n public static void main(String[] args) throws Exception {\n Bu...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "strangeSort(self,arr, k)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n tc = int(input())\n while tc > 0:\n arr = list(map(int, input().strip().split()))\n k = int(inpu...
eJzNVktuE0EQZcEFuEHL6whN9b85CRKDWEAWbIYsEgkJBXEIuBY77sOrT9vjxG1MSEKstD2ZeVX1qup19Xx7/uPXi2fyef0TF2++bD4uF1eXm1duE+aFHE3ycUl/mnwc+RBTdq2WnKLj61Kd3CtO7gUn335e2Iui5QY5Abdui2f4c3jAz/DAnuGPn/FNLFzNS5mXHt7tu+w81IkFMF/4R1jJB1ymzZnbnH++OH9/ef7h3aerS8t269MytWwsN82m52bxOhsr0bx8lVw5H6NuLjWDw/z2U7DM1dXKfGVnCZndrmIrRpqsetlcn7lVUz2X...
703,833
Semi Prime
Given a positive integer n. Find whether a number is a semiprime or not.Note:A semiprime is a natural number that is a product of two prime numbers . Examples: Input: N=35 Output: 1 Explanation: 35=7x5.So 35 is a semi-prime. Input: 8 Output: 0 Explanation: 8 is not a semi prime. Constraints: 1<=N<=10**9
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "int checkSemiprime(int N)" ], "initial_code": "// Initial Template for Java\n\nimport java.io.*;\nimport java.util.*;\n\nclass GFG {\n public static void main(String args[]) throws IOException {\n BufferedReader read...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "checkSemiprime(self,N)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n t = int(input())\n for _ in range(t):\n N = int(input())\n ob = Solution()\n print(ob.check...
eJxrYJmayMIABhFRQEZ0tVJmXkFpiZKVgpJhTJ6Zko6CUmpFQWpySWpKfH5pCUKqLiZPqVZHAVW9oSmJGkwsSdRgZESqBnMcGgxwaDDHpQGnp40MSdVhYkyyt0m1w9iIZDvMwRECjkZ84YAr4IBuxBsauPQBXYovJeDSBrSIsJ24YwCbh2NiSA0zY1zJEbdnqWk7KItSzQXG5AWAsTkxiSV2ih4AjNhe8Q==
705,190
Geek and knots
Given two walls A, B with M, N hooks respectively. You are given K ropes. By using one rope you can connect one hook on wall A with another hook on wall B. One hook can connect with only one rope.Find the number of different ways you can use all the K ropes. Two ways that use theexact same set of hooks from wall A and ...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "static int knots(int M, int N, int K)" ], "initial_code": "//Initial Template for Java\n\nimport java.io.*;\nimport java.util.*;\nimport java.math.*;\n\nclass GFG{\n public static void main(String args[])throws IOException\...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "knots(self, M, N, K)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n t = int(input())\n for _ in range(t):\n M, N, K = [int(x) for x in input().split()]\n ob = Solution(...
eJydlE0KwjAQhV30IEPWRTJJUxtPIlhxoV24qV20IIjiIfQc7jyf6Y8VxJfS9o9C+uXNm3n0Fjxewaw5Vk/3sj6LQ15UpViS4DRncqcISWSnItuV2X57rMrv8jXNxSWkH0ZKSf1jEow13TIiO83xpHFYd4+sVpGGgjF0SGzIAGphYnchOUm67ipgrXWsiiz26SySQtJacxyZxEYA186sQtJ4KJ5horY2SopRoTAB3rRCMTmQufYDT3bYHx7FkiOVcDIcP1W7mGC8ib4/+362bcHAkNEWfQentfBfBQO/ns9Wm/v8DZLvY5o=
703,861
Skip the work
Given an array A[ ] denoting the time taken to complete N tasks, determine the minimum amount of time required to finish the tasks considering that you can skip any task, butskipping two consecutive tasks is forbidden. Examples: Input: N = 2 A[] ={10,20} Output: 10 Explanation: we can take time of 10 units and skip 2...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "public int minAmount(int A[] , int N)" ], "initial_code": "//Initial Template for Java\n\nimport java.io.*;\nimport java.util.*;\nclass GfG\n{\n public static void main(String args[])\n {\n Scanner sc = new Scanner...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "minAmount(self, A, n)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n t = int(input())\n for _ in range(t):\n n = int(input())\n A = list(map(int, input().strip().split(...
eJyllEFLw0AQhT3o/xj2XCSzm90m/hLBFQ+ag5e1hxQKYunNmyf9v75ZajXgK5qGQJYk8+W9ebPZnX+8XZzV4/oVi5tn91hW69FdidNcYi7aiG9EowQsoluIGzar4X4cHu6e1uP+1djkss3FvSxkCki5BEkSpROA1JN67Ug97uPLshRvBOmlZQSmwB6oF+0gwkfzYjj4gZ7QMD8toQVIgp+e1CVStsQJC5CPYmsEcxEIoK9BKDzg4+hjNdERio+sFz4XXzXs4wAmAgSiigaCCz3D2XgcEFOwtqLJuu5ZjxNLrDWvjURw6oUmzgAmK540...
703,803
Candy Packets
Given a number N denoting candies. Find how many packetsare needed to contain the number if 1st packetcan contain 1 candy, 2nd packetcan contain 2 candies, 3rd packetcan contain 4 candies and so on. Examples: Input: N = 2 Output: 2 Explanation: Put 1 candy in first packet. Put 1 candy in second packet. Thus two,pack...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "static long countPackets(long N)" ], "initial_code": "//Initial Template for Java\n\nimport java.io.*;\nimport java.util.*;\n\nclass GFG {\n public static void main(String args[]) throws IOException {\n BufferedReade...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "countPackets(self,N)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n t = int(input())\n for _ in range(t):\n N = int(input())\n ob = Solution()\n print(ob.countPa...
eJydk0EKwjAQRV30ICXrIpkkk7aeRDCioEXcxC5aEETxEHpfmxoXXfxq7SaF8Cb//5m5J89DMuu/5bb7WV3E0ddtIxapIOeJRZaK6lxXu6bab05tE++M8zfnxTVLh4AmADAASEpA5JBQGiAkAaOkKRCjAGNkidxDpnMD/RDKzDJriyCYgtKGJ1NlkVs2gFIoPZIETSEmpEfxdB6GX/6CO/Zf+oHKhBLR9NRJtmNtgVEZSVilHVH57udYU0fGJ1QmhluB3u1DHmb8j/SwXHGK0fZ/tK8f8xdGa1xR
704,694
Count the number of ways to tile the floor of size n x m using 1 x m size tiles
Given a floor of size n x m and tiles of size 1 x m. The problem is to count the number of ways to tile the given floor using 1 x m tiles. A tile can either be placed horizontally or vertically.Both n and m are positive integers and 2 < = m. Examples: Input: n = 2, m = 3 Output: 1 Expanation: There is only one way t...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "public int countWays(int n, int m)" ], "initial_code": "//Initial Template for Java\n\nimport java.util.*;\nimport java.lang.*;\nimport java.io.*;\nclass GFG\n{\n public static void main(String[] args) throws IOException\n ...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "countWays(self, n, m)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n T = int(input())\n for i in range(T):\n n, m = input().split()\n n = int(n)\n m = int(m)\n ...
eJydU8sKwjAQ9NAPCTkXaXbNY/0SwYoH7cFL7aEFQQQ/Qv/XNFZEyDbEvaSQmZ3ZyfZePIdiEWrT+o/tVZ7abujlWkhVt0qALIVsLl1z6Jvj/jz030t5K8UvHFg4xOAoMAeuqrFYCTLWKAc4x30fOaLaC2qO4GIMIqE5CR2NbTJHYzFEjPOE5YQYPDdKdBLvyyadgSMAY8HOx86tkfWFsIrOF7Ifj6z8A0t5npj4wDZIvAbHUoZcVYFJqn+24W8Xdn5jkSo0ZHQ0PeR/L+WQVNq+t12HRrnmpy46Qds9li+jMU0/
702,946
Remaining String
Given a string s without spaces, a character ch and an integer count. Your task is to return the substring that remains after the character ch has appeared count number of times.Note: Assume upper case and lower case alphabets are different. “”(Empty string) should be returned if it is not possible, or the remaining su...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "public String printString(String s, char ch, int count)" ], "initial_code": "// Initial Template for Java\n\nimport java.io.*;\nimport java.util.*;\n\nclass GFG {\n public static void main(String args[]) throws IOException ...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "printString(self, s, ch, count)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n T = int(input())\n for i in range(T):\n s = input()\n ch = input()[0]\n count = in...
eJztW9tOwkAQ9cEPIX0mBmJ48cW0VPF+v7R1jaEXoFyWAi2UGhM/Qj/HNz/MgkRjQoEF7AXOCRkmOz3LbDLM7M7C6+b75+7GENKHrzw8cya1HJvbSXFZQouqphsQ6ycIVQnNcukUZ7iWodmG/tR07FFgRO0cREQxwb2kU38ThAcAwIqDUNevBpmAcjAuLxQH8N8IzbGwIs9xEBGVFm0QYEEbjvG1Z8gslStmtVZv0KblV6PgPcvkCaBBg7aqGqH+KxdUvqL3D1r4ETG9nLTaHdvp9ty+BwsssMACyyyW7214huW0KEmSLMuKovA8LwhC...
704,973
Pasha and Primes
Given an array of N integers and another array R containing Q queries(of l and r). Answer all Q queries asking the number of primes in the subarray ranging from l to r (both inclusive).Note: A is 0-based but the queries will be 1-based. Examples: Input: N=5,Q=3 A={2,5,6,7,8} R={{1,3},{2,5},{3,3}} Output: 2 2 0 Explan...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "ArrayList<Integer> primeRange(int N, int Q, int A[], int R[][])" ], "initial_code": "// Initial Template for Java\n\nimport java.io.*;\nimport java.util.*;\n\nclass GFG {\n public static void main(String args[]) throws IOEx...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "primeRange(self,N,Q,A,R)" ], "initial_code": "# Initial Template for Python 3\n\nimport math\n\nif __name__ == '__main__':\n t = int(input())\n for _ in range(t):\n N, Q = map(int, input().strip().split(\" \"))\n ...
eJy1VsuO00AQ5MCJr2j5vELTPW++BIkgDpADF7OHrLQC7Qr+Af6X6p5xoo0Ya8M6tuJ44nFXdU11T36+/vPrzSs73n/HzYcf09f59u4wvaOJdzM7irgysSfOxJXEk1TyTD5TYAoej4mdXjHTU97NycaBwm6ebmja39/uPx/2Xz59uzsskRHWTqbd/IhpDzd0Bhz19egI2BIVL2SKnpKjXKl4qmDjFBnEXMU0fAvARWmExgiPo9JJQyIIuMaikNdgiQoBAmSEOFhQpqLZJgWUYXhHeo5SlPa6B4NMA41NXQDErjHeyPZDUALFbkciI76d...
702,954
Max value after m range operation
Given an array arr of size n, with all initial values set to 0, the task is to perform a series of range increment operations as described below: Examples: Input: n = 5, a[] = [0, 1, 2], b[] = [1, 4, 3], k[] = [100, 100, 100] Output: 200 Explanation: Initially, arr = [0, 0, 0, 0, 0] After the first operation: arr = ...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1728666671, "func_sign": [ "public int findMax(int n, int[] a, int[] b, int[] k)" ], "initial_code": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n\n i...
{ "class_name": "Solution", "created_at_timestamp": 1728666671, "func_sign": [ "find_max(self, n, a, b, k)" ], "initial_code": "if __name__ == \"__main__\":\n t = int(input()) # Read the number of test cases\n\n for _ in range(t):\n n = int(input()) # Read the size of the array\n\n #...
eJzNVcGOwiAQ9WBivPgNL5yNKbRV65eYiNmD9rAX1kNNTIzGj9D/tWUsca1gqbsqkL4Ghsmb4Q0c2qdet6XbtJP/zLbsW63WGZuAcanyEejBA91YHyzdrNJFli6/ftZZaUmrUu2lYrs+bpyUqwE4BEJEiDHECGMkUiVFC6CBEwiCkCAiiAmGBCOCMUHuhqPSrWStPAuKlZ5TRKWbqPBH6M6sjXJcMBaIivhDDU28O/Nx58juTr40HzbGpVxt2515NOdt4rua9XQo9NbLp15owhmaoDJ8thK9FP5kSdk43prVtZNKJfVML1LwKJB/Uo01...
703,399
Remove Duplicates from unsorted array
Given an array arr of integers which may or may not contain duplicate elements. Your task is to remove duplicate elements. Examples: Input: arr[] = [1, 2, 3, 1, 4, 2] Output: [1, 2, 3, 4] Explanation: 2 and 1 have more than 1 occurence. Input: arr[] = [1, 2, 3, 4] Output: [1, 2, 3, 4] Explanation: There is no dup...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "static ArrayList<Integer> removeDuplicate(int arr[])" ], "initial_code": "// Initial Template for Java\n\nimport java.io.*;\nimport java.lang.*;\nimport java.util.*;\n\nclass Main {\n public static void main(String args[]) ...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "removeDuplicate(self, arr)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == \"__main__\":\n t = int(input())\n while t > 0:\n arr = list(map(int, input().split()))\n ob = Solution()\n ...
eJy1VUtOwzAQZYE4x8jrGvmXxOUkSASxgCzYhC5SCQmBOARckh03YPxCK9FkRi1VHekpn3nzfXbezz+/L86wrr/45ubFPPar9WCuyPi2946q6WUWZLrnVXc/dA93T+thY8/Gbf/W9uZ1QRM/ngJFSsyvqaFMS/JOdjSxlhxX7KYsWpYFzMAGWAMrYAJGYAB6ILgZ3AxuBjfXUnqnjCnUGdwYkwIwAhOwAtbABpjH5IC/mR5DFtpwZEqiUthC1IVCY8kU0RTZFOEkXahbfcm6qko1XBahUHJkGS0/WH5n+ZP9ayGrZR9PQh5RbEbUOqj3...
714,325
Total Cuts
You are given an array A of N integers and an integer K, and your task is to find the total number of cuts that you can make such that for each cut these two conditions are satisfied 1. A cut divides an array into two parts equal or unequal length (non-zero). 2. Sum of the largest element in the left part and the small...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1679290094, "func_sign": [ "public static int totalCuts(int N, int K, int[] A)" ], "initial_code": "import java.io.*;\nimport java.util.*;\nclass IntArray\n{\n public static int[] input(BufferedReader br, int n) throws IOException\n {\n Stri...
{ "class_name": "Solution", "created_at_timestamp": 1679290094, "func_sign": [ "totalCuts(self, N : int, K : int, A : List[int]) -> int" ], "initial_code": "class IntArray:\n def __init__(self) -> None:\n pass\n\n def Input(self, n):\n arr = [int(i) for i in input().strip().split()] #...
eJy1lc1KxEAQhBUEfYwi50W65yeZ8UkEIx50D17iHrIgiOJD6Pvak3V3WTalUdcMQ3KYqe76qiGvJ+9np0fDc3lsH1dP1X23WPbVBSptOxXb0TYcPAIiajRIyFCpZqjmj4v5bT+/u3lY9p+3fNu9tF31PMOuVL1Si9gsIhCJQGMCru1KI8maqE0iEIlAJJw14IgdqEId1EMDNEJraANN0AzHzCZSqDCLhZ3YXXhBEERBLWgESZCtnJSStu2A2gm1IxpZIWVYC5JCBtvltouoCRHL64zUoASD4wyPRyYyNZEx82nwXnrJNGiWkh8UIgSM...
702,983
Palindrome Sentence
Given a single sentence s, check if it is a palindrome or not. Ignore white spaces and any other character you may encounter. Examples: Input: s = race car. Output: 1 Explanation: processing str gives us "racecar" which is a palindrome. Input: s = hello world. Output: 0 Explanation: processing str gives us "hellow...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1731309703, "func_sign": [ "public boolean sentencePalindrome(String s)" ], "initial_code": "import java.io.*;\nimport java.util.*;\n\nclass GFG {\n public static void main(String args[]) throws IOException {\n Scanner sc = new Scanner(System.i...
{ "class_name": "Solution", "created_at_timestamp": 1731309703, "func_sign": [ "sentencePalindrome(self, s)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == \"__main__\":\n t = int(input())\n for tc in range(t):\n s = input()\n ob = Solution()\n if ob.sente...
eJytkkFLxDAQhT3o/3jmHBa8epGCi/TgKvSgYESm21EX0qS0aauI4I/Q/2uari6CIs1uLxko882bee9t/+PxYC981+SLmxexMlXrxDHEkTIJSjIShEqP75IMaYlL/5R0qIyQEPxU8dJxcWdbt269J92w//sq8RO4sPijxdXtrx1X1GDlwugatg6FQ4qG+pPp85NcM3qPTOXIwFznNJ2TOa5gDYxFxa6JuMS8Izmcc5DBjJzZ72nCeh1HbHZez3DRa5BjlM8o2ZFGb+tyOurU4sHL4SDszBYxd0ZGxpFXg0WSJRFB4Y6930UxeO5rE+1R...
704,853
Knight Walk
Given a square chessboard, the initial position of Knight and position of a target. Find out the minimum steps a Knight will take to reach the target position.If it cannot reach the target position return -1. Examples: Input: N=6 knightPos[ ] = {4, 5} targetPos[ ] = {1, 1} Output: 3 Explanation: Knight takes 3 step ...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "public int minStepToReachTarget(int KnightPos[], int TargetPos[], int N)" ], "initial_code": "import java.util.*;\nimport java.lang.*;\nimport java.io.*;\nclass GFG\n{\n public static void main(String[] args) throws IOExcep...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "minStepToReachTarget(self, KnightPos, TargetPos, N)" ], "initial_code": "T = int(input())\nfor i in range(T):\n N = int(input())\n KnightPos = list(map(int, input().split()))\n TargetPos = list(map(int, input().split(...
eJylk0sKwjAQhl3oPYasi0zSpFq9iGDEhXbhJnbRgiAFD6H3dVptVez0WUj4A8k3/zx6mz7Ws0nxbTSJ7VWcXJwmYgVCWicR0TqDCCYX+RHyTXggokscHZLouD+nyfuF72vrROZBHUWCbCcEQcATKh8GJQnJMFSjB/wkMsqDJqH5PJY8IgxDoGWdAjXEwst8mUw/QhFXkwGdC8nWwPcbqqgMwsKQoA3o0G8aTIlQphKsjT9Aa/dq7mvkwnLW64JyE/BD78gbFrbrq+8hGWWzc9r9frCmFlnqytg29SgWYxy7oIq0Rba7z5+7JH7I
701,276
Unit Area of largest region of 1's
Given a grid of dimension nxmcontaining 0s and 1s. Find the unit area of the largest region of 1s. Region of 1's is a group of 1's connected 8-directionally (horizontally, vertically, diagonally). Examples: Input: grid = {{1,1,1,0},{0,0,1,0},{0,0,0,1}} Output: 5 Explanation: The grid is- 1 1 1 0 0 0 1 0 0 0 0 ...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "public int findMaxArea(int[][] grid)" ], "initial_code": "import java.util.*;\nimport java.lang.*;\nimport java.io.*;\nclass GFG\n{\n public static void main(String[] args) throws IOException\n {\n BufferedReader ...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "findMaxArea(self, grid)" ], "initial_code": "if __name__ == '__main__':\n T = int(input())\n for i in range(T):\n n, m = map(int, input().split())\n grid = []\n for _ in range(n):\n a = li...
eJztWktu20AM7aIHGWgdFKRjBUhPEqAKski9yEbJwgYCFC1yiOYI2fWQtSWPxN+TrUWduJgYgcej4SP5huRwDL98fv1Tfer+bt62g28/qof2abOuvqaKm7ZOddNyou2LE++G3A2pabuZ3Yd+AfcLaL+WqotUrZ6fVvfr1fe7x806Yy6b9lfTVj8vkta0TMsenjMiCYXDIwR7CWB5K7w3NhvcjylDZos5uzVO7MfC13gljSs5sVCjSCH5aMQkqUhonTQJ0LC4RjTUiYed9OYYN6VRw6LeDk5+kTGTlFuswVlhiMiShklFYq8cC3lmDDtD...
705,474
Overlapping rectangles
Given two rectangles, find if the given two rectangles overlap or not. A rectangle is denoted by providing the x and y coordinates of two points: the left top corner and the right bottom corner of the rectangle. Two rectangles sharing a side are considered overlapping. (L1 and R1 are the extreme points of the first rec...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "int doOverlap(int L1[], int R1[], int L2[], int R2[])" ], "initial_code": "// Initial Template for Java\n\nimport java.io.*;\nimport java.util.*;\n\nclass GFG {\n public static void main(String args[]) throws IOException {\...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "doOverlap(self, L1, R1, L2, R2)" ], "initial_code": "# Initial Template for Python 3\n\nimport math\n\nif __name__ == '__main__':\n t = int(input())\n for _ in range(t):\n p = [0] * 2\n q = [0] * 2\n ...
eJzVVUtOxDAMZcGGW0RZT1DSjwScBIkiFtAFmzKLGWkkBOIQcCZ2nAk7aVOndT5lR+wZWYmbPtvP7sf518/FmV2332DcvcrnYX88yBsh627QwljVogUxrdC4p0UFogwqSDcYPS1BzOtpEUuR88AmLt6UOyH7075/PPRPDy/Hw4gLXvgOMMi/fNsJArxyIA3RCrUbFI90Eh5cBIZ7tYkAgOfxDnutalFBQgDZ+NkMshEkIbI5amhx4X5hsJwzbqcKSm5/qO5wjglFLWPKQOaZwF5QUH0Tj6/2aMeAVIUk1haxCd8L1Jh4sNypQs8w2AVl...