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 |
|---|---|---|---|---|---|---|---|
703,825 | Count digits in given number N which divide N | Given a number S(in the form of a string). Count all the digits in Swhich divide S. Divisibility by 0 is not allowed. If any digit in Swhich is repeated divides S, then all repetitions of that digit should be counted.
Examples:
Input:
S = "35"
Output:
1
Explanation:
Only 5 digits 35,thus the answer is 1.
Input:
S = ... | geeksforgeeks | Easy | {
"class_name": "Solution",
"created_at_timestamp": 1615292571,
"func_sign": [
"static int divisibleByDigits(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 Buffer... | {
"class_name": "Solution",
"created_at_timestamp": 1615292571,
"func_sign": [
"divisibleByDigits(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.divisib... | eJylVMsKwjAQ9KD/EXIu0jyb+iVCK4Lag5faQwqCKH6E/q+pJNUWdkvoXFJIJpnZne5z+T6sFl9sC/dR3Oi5blpLN4Syss4DypomhFbXpjra6rS/tNYfcjsPt3lPyJDJAuKZKUhhEIULqXRmcpiqASoPiNapPECiAQ0GRBvNTaaVFByuqgCYQohojnQASRKWmOmRSzWUjhpArBvdi8KLwLE75l7C0lHiJruJyGG9GKxow5xOlhB675dY/DeDgjtbb5fDbo1WjuQQbJOfPn9C0HGEDwi879j4CHnevdYfTMuexA== |
702,918 | Sub-Array sum divisible by K | You are given an array of integers and a value k. The task is to find the count of all sub-arrays whose sum is divisible by k.
Examples:
Input:
arr[] = [4, 5, 0, -2, -3, 1], k = 5
Output:
7
Explanation:
There are 7 sub-arrays whose is divisible by k: [4, 5, 0, -2, -3, 1], [5], [5, 0], [5, 0, -2, -3], [0], [0, -2, -3]... | geeksforgeeks | Medium | {
"class_name": "Solution",
"created_at_timestamp": 1615310465,
"func_sign": [
"public int subCount(int[] arr, int k)"
],
"initial_code": "import java.io.*;\nimport java.util.*;\n\nclass Main {\n public static void main(String args[]) throws IOException {\n BufferedReader read = new BufferedRead... | {
"class_name": "Solution",
"created_at_timestamp": 1615310465,
"func_sign": [
"subCount(self, arr, k)"
],
"initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n tc = int(input().strip())\n while tc > 0:\n arr = list(map(int, input().strip().split()))\n d = in... | eJyVUzFOAzEQpIB/jK7mkHfttX28BIkgCkhBEygSCQkh8Qj4ER2fYjYJQoANR6LzbZTxenZm/HT48nZ0sP2cvbI4fxhuVneb9XCKQRargjFCIAGjIYOvhIpRIYpRBGmxysMxhuX93fJqvby+vN2sP3bzv+HxGF8bSghQPjF4Ly7mReZS+FT/MXEhLDi409us1XuaJu7mMrPgAdY5IIYmeSNv0qYUfBXD5EyNSiiL6IWxyGRXOo1Lq2/Ev7/c1KNu0uTuViaYUO2K6lwDbRTKITFDLLIoZF8J1JB8R2+G2jpAkZiQ6llhOCRRBzaj2VCF... |
701,303 | The Modified String | Ishaan is playing with strings these days. He has found a new string. He wants to modify it as per the following rules to make it valid:
Examples:
Input:
S = aabbbcc
Output:
1
Explanation:
Inaabbbcc 3 b's occur
consecutively, we add a 'd',and Hence,
output will be aabbdbcc.
Input:
S = aaaaa
Output:
2
Explanation: ... | geeksforgeeks | Easy | {
"class_name": "Solution",
"created_at_timestamp": 1619250093,
"func_sign": [
"public static long modified(String a)"
],
"initial_code": "import java.util.*;\nimport java.io.*;\nimport java.lang.*;\n\nclass gfg\n{\n public static void main(String args[])\n {\n Scanner sc = new Scanner(System... | {
"class_name": "Solution",
"created_at_timestamp": 1619250093,
"func_sign": [
"modified(self,s)"
],
"initial_code": "# Initial Template for Python 3\n\nimport atexit\nimport io\nimport sys\n\n_INPUT_LINES = sys.stdin.read().splitlines()\ninput = iter(_INPUT_LINES).__next__\n_OUTPUT_BUFFER = io.StringIO()... | eJy9VduOgjAQ3QeT/Q3SZ2NEN8b4JSZiDJSu9wJaUDQaP2L9FN/246yNiBpmCmg8vEygPZ2Zc6YcKsf/7y+F7kkGvS0Zcz8UpGMQ0+LOFRYnVYOwtc+oYO7AC8V1TdPie/lxVzUeN9q241AJV4ExBjL8QAxqP7XV+fYFSUApSNYGyDYYQDYTzA3cUgerQZ7CbH4pgMc0WrAGLvsdjsaT6WzOPc+TLEEQLCSWSyFEKBFF0UpifUEcx1g7TcQsqcRpqAxwewG3yYRcmKS0QQKYtZHHTBnaPov7uFpjRdyRuFB6n+XSCXJdvrqzh//D3YDl... |
713,588 | Maximum Bipartite Matching | There are M job applicants and N jobs. Each applicant has a subset of jobs that he/she is interested in. Each job opening can only accept one applicant and a job applicant can be appointed for only one job. Given a matrix G with Mrows and N columnswhere G(i,j) denotes i**thapplicant is interested in the j**thjob. Find ... | geeksforgeeks | Medium | {
"class_name": "Solution",
"created_at_timestamp": 1673953262,
"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": 1673953262,
"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 ... | eJzVVMEKwjAM9eDBzwg9iySDXfwSQcWD7uBlepggiODZm6D/a5d1TrtktBMPbjS0W17ymqbvMnzcRgN+Zlc7mZ/MNt8fCjMFQ4ucoDRmDCY77rN1kW1Wu0PR/DfnMQgIVBAoIRJI6kSgpUo6gDYo9gBiBQynqnm246eQMjF+iekBLzlhtfAc3FclRSrtgrOgC4Ix05jTIcvMkfVGtS9v/Iun1tJyDVKg14kqts6i2IaZaN85isHfyQvBP3fXCu5vX2SuOIg1lZkLDjJaZe456GiV+cfBd6HVFmhftjKRk7YF5XaEKUENC9YN1qWy0ahb... |
703,296 | Rod Cutting | Given a rod of length N inches and an array of prices, price[]. price[i] denotes the value of a piece of length i. Determine the maximum value obtainable by cutting up the rod and selling the pieces.
Examples:
Input:
n = 8,
price[] = {1, 5, 8, 9, 10, 17, 17, 20}
Output:
22
Explanation:
The maximum obtainable value i... | geeksforgeeks | Medium | {
"class_name": "Solution",
"created_at_timestamp": 1615292571,
"func_sign": [
"public int cutRod(int price[], int n)"
],
"initial_code": "import java.io.*;\nimport java.util.*;\n\nclass RodCutting {\n\n public static void main(String args[])throws IOException {\n BufferedReader in=new BufferedR... | {
"class_name": "Solution",
"created_at_timestamp": 1615292571,
"func_sign": [
"cutRod(self, price, n)"
],
"initial_code": "# Initial Template for Python 3\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().split()]\n ob... | eJzNlL9KxEAQxi3Ews43+Nj6kJ3Z2c3GJxGMWOgVNvGKHAii+BD6vk72cmC4TI6cjZkUIcP89pt/+3n+fXVxVp7bS/24e3PP7WbbuRs4atr+9W4Ft37drB+79dPDy7bbu33TfjSte19hHMQahGhERSOopxEObOnZBeNRI6NCQoQggGc4Jij2elijRSlJaVmpiiZVpcAAEpCVJZlpqiNixgxgZQHZ73SK6qOEwEiqizM4avq9Us8C9pIhvk7IVOu/FLIWhquUkWIMSfMhXzE4MYkmzMI5Wx0sTkOOylTKzpb2rsQO9V4aq3o8RmYQzKEt... |
714,217 | Minimum Number | You are given an array arr of n elements. In one operation you can pick two indices i and j, such that arr[i] >= arr[j]and replace the value of arr[i] with (arr[i] - arr[j]). You have to minimize thevalues of the array after performing any number of such operations.
Examples:
Input:
n = 3
arr = {3,2,4}
Output:
1
Expl... | geeksforgeeks | Easy | {
"class_name": "Solution",
"created_at_timestamp": 1678707539,
"func_sign": [
"public static int minimumNumber(int n, int[] arr)"
],
"initial_code": "import java.io.*;\nimport java.util.*;\nclass IntArray\n{\n public static int[] input(BufferedReader br, int n) throws IOException\n {\n Strin... | {
"class_name": "Solution",
"created_at_timestamp": 1678707539,
"func_sign": [
"minimumNumber(self, n, arr)"
],
"initial_code": "# Initial Template for Python 3\n\nif __name__ == \"__main__\":\n for _ in range(int(input())):\n n = int(input())\n arr = [int(i) for i in input().split()]\n ... | eJy1VD1PxDAMZUBiZmN86nxCifPNL0GiiAE6sIQbehISuhM/Av4vTiFFN1ypq+LKktPIznPec97PP68uzga7veTg7q15zttd39yg0W12bdaqGlI1xGoI1eCrtbnZoOlet91j3z09vOz634IH3txvcHwKZ2iMnzg9tJlg4BCgOd9AB3GN2OYUg3fWEJcgY50PMWFYK94Br9TwH76GcDWErSFMDcUQtDq6bIYhX4gPNdz3yGoN4hjJL9IWLgkWUZyaCpbSDntpi9iZTGXZHbtnlwNy34CYIzg5J8TaYhlExCIuRsAC0MGCGBkZAnkunhSM... |
702,787 | Find the element that appears once | Given a sorted array arr[] of n positive integers having all the numbers occurring exactly twice, exceptfor one number which will occur only once. Find the number occurring only once.
Examples:
Input:
n = 5, arr[] = {1, 1, 2, 5, 5}
Output:
2
Explanation:
Since 2 occurs once, while other numbers occur twice, 2 is the... | geeksforgeeks | Medium | {
"class_name": "Sol",
"created_at_timestamp": 1615292571,
"func_sign": [
"public static int search(int n, int arr[])"
],
"initial_code": "// Initial Template for Java\n\nimport java.io.*;\nimport java.util.*;\n\nclass GfG {\n public static void main(String[] args) {\n\n Scanner sc = new Scanner... | {
"class_name": "Solution",
"created_at_timestamp": 1615292571,
"func_sign": [
"search(self, n, arr)"
],
"initial_code": "# Initial Template for Python 3\n\nif __name__ == \"__main__\":\n t = int(input())\n for tc in range(t):\n n = int(input())\n arr = list(map(int, input().split()))\... | eJzNVM1KxEAM9iD4GqHnRabz02l9EsGKB+3By7iHLgii+BD6oN48mmTablsmpesuYidsZ+nky5d8k7yff35fnPFz/YWbm5fsMWx3bXYFmamDq0MOOWhwgFtfBx33oBUYMvye92c0GFwWF50osg1kzfO2uW+bh7unXduh6jq8IY7iV8G/2esGRnERsEJMBWhaDaHAsjklADuVAsNwhsAIjbAUB80doGk24xBWIqsiqHEpbFuHsg4KEHsogKVgqYoUHNiDhxJXBXzKdu5irmSFAi8RNMwrsqtiSaUysFDIC4mxGTbL5tgKOmEEOYm4QIL8... |
712,540 | Partition Array for Maximum Sum | Given an integer arrayarr, partition the array into (contiguous) subarrays of lengthat mostk. After partitioning, each subarray has their values changed to become the maximum value of that subarray.Returnthe largest sum of the given array after partitioning.
Examples:
Input:
n = 7
k = 3
arr = [1,15,7,9,2,5,10]
Output:... | geeksforgeeks | Medium | {
"class_name": "Solution",
"created_at_timestamp": 1667049219,
"func_sign": [
"public int solve(int N, int k, int arr[])"
],
"initial_code": "//Initial Template for Java\n\nimport java.util.*;\nimport java.lang.*;\nimport java.io.*;\n\nclass GFG{\n public static void main(String args[]) throws IOExcep... | {
"class_name": "Solution",
"created_at_timestamp": 1667050151,
"func_sign": [
"solve(self, n, k, arr)"
],
"initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n t = int(input())\n\n for _ in range(t):\n n, k = input().split()\n n = int(n)\n k = int(k)\... | eJzdVs1OhDAQ9uDRh5hwXk3/pgWfxESMB+XgBffAJiZG40Po+zptqVmFQZZlf3SHpZNCv/mf4e30w5ydhN/VOTHXz9lDvVw12SVksqylAAx3GUm0t7iWdbaArHpaVndNdX/7uGrSSUHPXunxywJ+ACKYskaIlIBFe6V95JE1MshKgC1rTXCG/ggFKLC06pbPaXXEaeI1j+9yDp+Ok/7+NElAwnaEWXi1C2JcEGYCvAQB3rLw6oAozYjSAkgLRZiSkL3qaTXBGC/RBXPsmpF5kB52WJkKLRcYIUJEu7b8ix3WIwWbqhgdokJGeRCM0VYd... |
702,957 | Closing bracket index | Given a string with brackets ('[' and ']') and the index of an opening bracket. Find the index of the corresponding closing bracket.
Examples:
Input:
S = "[ABC[23]][89]"
pos = 0
Output:
8
Explanation:
[
ABC[23]
]
[89]
The closing bracket corresponding to the
opening bracket at index 0 is at index 8.
Input:
S = "ABC[... | geeksforgeeks | Easy | {
"class_name": "Sol",
"created_at_timestamp": 1619436863,
"func_sign": [
"int closing(String s, int pos)"
],
"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... | {
"class_name": "Solution",
"created_at_timestamp": 1619436863,
"func_sign": [
"closing(self,s, pos)"
],
"initial_code": "# Initial Template for Python 3\n\nt = int(input())\nfor tc in range(t):\n s = input()\n pos = int(input())\n ob = Solution()\n print(ob.closing(s, pos))\n print(\"~\")\... | eJytlLtOw0AQRSngPyLXAcV2IIHOedhx7LwfBO5eUUAKGpMikZAQiI+AL6TjK1gvBBBiEicw1TZzdu6dx+Pu8+vejonJi37gzrpOZou5dZKzbJXAq6CKWh1+wEbIZsS4hXany16fKnGtfM6a3s6ml/Pp1cXNYr5MLKnkQSXWfT73A2c7cIs4PEKpzOMCvQqrNdR9BA2GTUaxhpYEqMg0QRMqsaWSClK6ByMRWiO1SGqVjDTJEUiOSIJHjaJBQaMQIkXF1JaxQ22axhYErOuu1Pel8V2naP2RhGEKkA1yxDy5ZjuDpwhgjIAxgksj+hxw... |
713,153 | Minimum X (xor) A | Given two integersAandB, the task is to find an integerXsuch that(X XOR A)is minimum possible and the count of set bit inXis equal to the count of set bits inB.
Examples:
Input:
A = 3, B = 5
Output:
3
Explanation:
Binary(A) = Binary(3) = 011
Binary(B) = Binary(5) = 101
The XOR will be minimum when x = 3
i.e. (3 XOR ... | geeksforgeeks | Medium | {
"class_name": "Solution",
"created_at_timestamp": 1671445695,
"func_sign": [
"public static int minVal(int a, int b)"
],
"initial_code": "// Initial Template for Java\n\nimport java.util.*;\nimport java.io.*;\nimport java.lang.*;\n\nclass GFG {\n public static void main(String[] args) throws IOExcept... | {
"class_name": "Solution",
"created_at_timestamp": 1671445695,
"func_sign": [
"minVal(self, a, b)"
],
"initial_code": "# Initial Template for Python 3\n\nimport atexit\nimport io\nimport sys\n\n_INPUT_LINES = sys.stdin.read().splitlines()\ninput = iter(_INPUT_LINES).__next__\n_OUTPUT_BUFFER = io.StringIO... | eJy9Vc2OEzEM5rAX3qKa8wrFsWM7+wJ744zErDhAD1yGPXQlJLSjfQh4X5yfGWCbDG1BW1VpqsT+7M+f46erH29fv8qfd7e2ef9t+DzdPxyGm90Qxgns6zyOUwCftzRO3pGMkxsnWzWvMlzvhv3X+/3Hw/7Thy8Ph+qgmM7Ves5GtlJeJa/D4/XuN0i7TsjR7nlQsgBUUFMQQsLmw7MHSoGQBuEObPUwr9a2A0alFmJKyyMFFo3jFFU4EHozWn7raS/FchoLitl48S0YSocBufxY7uiFdY1LIZoZuciZXy1cdzCrh3l1Mi8O5sW6nScL... |
700,434 | Multiply Matrices | Given two square Matrices A[][] and B[][]. Your task is to complete the function multiply which stores the multiplied matricesin a new matrix C[][].
Examples:
Input:
N = 2
A[][] = {{7, 8}, {2 , 9}}
B[][] = {{14, 5}, {5, 18}}
Output:
C[][] = {{138, 179}, {73, 172}}
Input:
N = 2
A[][] = {{17, 4}, {17 , 16}}
B[][] = {{9... | geeksforgeeks | Easy | {
"class_name": "GfG",
"created_at_timestamp": 1617795742,
"func_sign": [
"public static void multiply(int A[][], int B[][], int C[][], int N)"
],
"initial_code": "import java.util.Scanner;\nclass Matrix{\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint t = sc.... | {
"class_name": null,
"created_at_timestamp": 1617795742,
"func_sign": [
"multiply(A, B, C, n)"
],
"initial_code": "if __name__ == '__main__':\n t = int(input())\n for i in range(t):\n n = int(input())\n arr = list(map(int, input().strip().split()))\n matrix1 = [[0 for i in rang... | eJy9ls1uXEUQhVmw5R1KXkeoq6t/qnkSJIxYgBdshiwcKRIC8QwIFrwt3+kbEyfy3ESRie/Yvneq6++cUzXzx5d///PVF/vn2z+5+e7Xm58vL1/d33xjN3578XJ7ad1mWq3my6Jbm5bLvLj1YbNbDYthrdl0G8OSo26xrC9bhXNWi0WxVqwXG8VmsSyHiV9X4Aj59y7/ORVikQFXrzt8M2og25iqZGeXq+9M1VpYbzYok/TTVmLnDHk9rLZd9LA+baTNN1U5/kdHlEYr1UbYbJbd1sA+sROnWe27vWk9baxdOr4FX4I77Q+LaS3Vr1pz... |
702,720 | Count Increasing Subsequences | Given an array arr[] consisting of digits (where each digit ranges from 0 to 9), the task is to count all possible subsequences within the array where each digit in the subsequence is strictly greater than the previous digit. The final count should be returned modulo 10**9+7.
Examples:
Input:
arr[] = [1, 2, 3, 4]
Outp... | geeksforgeeks | Medium | {
"class_name": "Solution",
"created_at_timestamp": 1617733136,
"func_sign": [
"public static int countSub(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": 1617733136,
"func_sign": [
"countSub(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 ... | eJzlVUsKwjAQdeHCYwxZF+mkST+eRFBxoV24qS4qCKJ4CD2aOw/jWPGLr40KCtrX0ELzJjMvb5pVfbNr1IqrvZWXzlyNssk0Vy1S3M1YeaTS2SQd5OmwP57ml0/LbqYWHt3OT+gngKr2fVA3U0CWIuFqMhRSDCIkFgoXCz2UIEZCaULCJ4BvielvB9BKswngfmlBIDACKwgFkSAWlDggYI28z8JzGCByhJzBRaKmSPGQHgpg2bkpn/QW0x2e5F+v/ahXynKKKnOSG3BDh15DtaB1oTFc8nxFvIIj67psQJnbjxYq8Q9rWPNZr7f/8K5u... |
703,670 | Difference between highest and lowest occurrence | Given an array, the task is to find the difference between the highest occurrence and lowest occurrence of any number in an array.Note: If only one type of element is present in the array return 0
Examples:
Input:
arr[] = [1, 2, 2]
Output:
1
Explanation:
Lowest occurring element (1) occurs once. Highest occurring e... | geeksforgeeks | Easy | {
"class_name": "Solution",
"created_at_timestamp": 1617637881,
"func_sign": [
"public int findDiff(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(... | {
"class_name": "Solution",
"created_at_timestamp": 1617637881,
"func_sign": [
"findDiff(self, arr)"
],
"initial_code": "def main():\n T = int(input())\n\n while T > 0:\n a = list(map(\n int,\n input().strip().split())) # Convert input to list of integers\n print... | eJztV01v1DAQ5cCdv/CUc4Xiz9j8EiQWcYA9cAk9bBESqsSPgP/L89gJSWN3d1sopSLemdl2E8/HezPe/fb8x/WLZ3K9/sw3b752H8fLq0P3Cp3bjaqXC1EuuPxXMdOHs81rN8rNAUsz1IyfHsmPcR9oiqHY7AaeMlBCCqL4Kg4ilibUTNXrQE/QMLBw8BjAm7lvd4Fu/+Vy//6w//Du09WhFMHsRtaBPrXo7voCixKlT1c1cctS6LR2o8n/s6s7fDZDNqGUeVXQX+W/aSv5T6aRRi/Rq00Ctl4MKMavoQyUhXJQhGqAClCREGWosqgi... |
701,344 | Maximum of minimum for every window size | Given an integer arrayarr[]of sizeN. The task is to find the maximum of the minimum of every window size in the array.Note:Window size varies from1to theN.
Examples:
Input:
N = 7
arr[] = {10, 20, 30, 50, 10, 70, 30}
Output:
{70, 30, 20, 10, 10, 10, 10}
Explanation:
1. First element in output indicates maximum of m... | geeksforgeeks | Hard | {
"class_name": "Solution",
"created_at_timestamp": 1615292571,
"func_sign": [
"static int[] maxOfMin(int[] arr, int n)"
],
"initial_code": "import java.util.*;\nimport java.io.*;\n\nclass Main {\n\n public static void main(String[] args) throws IOException {\n BufferedReader br =\n new Buffer... | {
"class_name": "Solution",
"created_at_timestamp": 1615292571,
"func_sign": [
"maxOfMin(self,arr,n)"
],
"initial_code": "# Initial Template for Python 3\n\nimport atexit\nimport io\nimport sys\n\n# Contributed by : Nagendra Jha\n\n_INPUT_LINES = sys.stdin.read().splitlines()\ninput = iter(_INPUT_LINES)._... | eJy1VUtOxDAMZcGCY1hdj1CcT5tyEiSKWMAs2JRZzEhIaBCHgPOx4xzYTtJ0kNJ2YKhdtUr9e/GL+3b+8XVxJtf1J73cvFSP/Wa3ra6gwq5H1fUOEAxYqEFDAx4ctNUKqvXzZn2/XT/cPe220aGl745ER0GSrn/t+mq/gh+BNQdXoOl2olpBo8ArQHk3CiyvF1KxH459g+KhlpI7ugkTV6ip3lpwtZKZlghqISsZtGTZkIcbEGYppNO0iRacJAtJQzoOYmllFBXnE7NHFlxYAiMeF28H+Nzagy3AvLxkG1KkaSnUJWXJBa1c4eHDowmP... |
707,314 | Max Min | Given an array A of size N of integers. Your task is to find the sum ofminimum and maximum elementin thearray.
Examples:
Input:
N = 5
A[] = {
-2, 1, -4, 5, 3}
Output:
1
Explanation:
min = -4, max = 5. Sum = -4 + 5 = 1
Input:
N = 4
A[] = {
1, 3, 4, 1}
Output:
5
Explanation:
min = 1, max = 4. Sum = 1 + 4 = 5
Const... | geeksforgeeks | Easy | {
"class_name": "Solution",
"created_at_timestamp": 1620210852,
"func_sign": [
"public static int findSum(int A[],int N)"
],
"initial_code": "//Initial Template for Java\n\n//Initial Template for Java\nimport java.io.*;\nimport java.util.*;\nclass Array {\n\tpublic static void main (String[] args) {\n ... | {
"class_name": "Solution",
"created_at_timestamp": 1620212277,
"func_sign": [
"findSum(self,A,N)"
],
"initial_code": "# Initial Template for Python 3\n\nt = int(input())\nfor _ in range(0, t):\n n = int(input())\n a = list(map(int, input().split()))\n ob = Solution()\n print(ob.findSum(a, n))... | eJzFVMtKBDEQ9CD4G82cjUwnmZnE7/Ag7IoH3YOX0cMKgih+hP6v1T2PrI+WWRHsJZnKJqmuVB4vh2+rowON8zOA1WN109/db6tTqnjdt+vecT0F1bTTcHkKKsg1dV0dU7V5uNtcbTfXl7f325GuXvfP6756OqaPORgdDX35GSxs0SRIbaDKowSR6kUtxZqCpciZZBmyyFOgCCktdZQo7yuoE++gB3LIRThDriXXWVrSD/YEykLEDZTIAiMxaBO1FlljkTW6oeRVDyfhA1VLnuEYVDJLFihO5K0Fe4Pc16IWNFLJWZCTkfCBeciDkmEA... |
707,939 | Count the Substrings | Given a stringS. The task is to count the number of substrings which contains equal number of lowercase and uppercase letters.
Examples:
Input:
S = "gEEk"
Output:
3
Explanation:
There are 3 substrings of
the given string which satisfy the
condition. They are "gE", "gEEk" and "Ek".
Input:
S = "WomensDAY"
Output:
4
... | geeksforgeeks | Easy | {
"class_name": "Solution",
"created_at_timestamp": 1624364410,
"func_sign": [
"int countSubstring(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": 1624364410,
"func_sign": [
"countSubstring(self, S)"
],
"initial_code": "# Initial Template for Python 3\nif __name__ == '__main__':\n t = int(input())\n for _ in range(t):\n S = input()\n ob = Solution()\n ans = ob.countSubstr... | eJyllUtvgkAUhbto0r9hWJtGMZq2O0BqrSj4QqU2DS+fM4AIiDRtuuyum/b/lmkX1cXVwV4SQkL4hjnnnjtv518fF2c/NXxPHx6embnjhQFzk2OKY0c3TMueTGfzxRJhx/VW/joIo0281cYOk88xduzZZmBbT24Y/H31mr58yef2URwvVMXb2l39viE1W7LS7nR7fXUwHGngIgm4CFuBVjEES5zUZvVFAzUd2Wv73aAfDeIRzCpWrgFYkiSapu3eQUgJYnA6uXiDNwRTMKtW1RJt0YZ/hoX0w02n5cqesmr7nXU36IX9SN0M4uF2lGg6... |
705,802 | Moving on grid | Given a grid on XY plane with dimensions rx c, the twoplayers (say JONand ARYA) can move the coin over the grid satisfying the following rules:
Examples:
Input:
r = 1, c = 2
Output:
JON
Explanation:
ARYA lost the game because
he won't able to move after JON's move.
Input:
r = 2, c = 2
Output:
ARYA
Explanation:
Afte... | geeksforgeeks | Medium | {
"class_name": "Solution",
"created_at_timestamp": 1615292571,
"func_sign": [
"public String movOnGrid(int r, int c)"
],
"initial_code": "//Initial Template for Java\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": [
"movOnGrid(self, r, c)"
],
"initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n T = int(input())\n for i in range(T):\n r, c = map(int, input().strip().split())\n ob = Solution()\... | eJxrYJnqzs4ABhEOQEZ0tVJmXkFpiZKVgpKhQUyeoQEIKFiCQEwemFKAiMXkmYKlzE3BHDClYAqRMVYwjckzUbAA6VcwBLINFQzBZoH0xuQZKRjH5CnpKCilVhSkJpekpsTnl5ZALfXy94vJq4vJcwyKdAQzYALoNFwBJgNdqVKtjgKSvxDuUQB50VzBJCbPAuRiQxOwAA6X4TQeQwLNPiOE/w0gQQAOJGKtwWoa1AyYkQSDE4dhhrBYNMXrJty6DRWMSNVlDEtHWBMVaoIjNZFgcSDCPAuy/GdIKJ6w2Qn0DmlWQVMfyYmSYO4gnIqo... |
707,041 | IPL 2021 - Match Day 1 | Due to the rise of covid-19 cases in India, this year BCCI decided to organize knock-out matches in IPL rather than a league.
Examples:
Input:
A = (3, 2)
B = (3, 4)
c = (2, 2)
Output:
2.000000 0.000000
Explanation:
There are two options for
point D : (2, 4) and (2, 0) such that ABCD
forms a parallelogram. Since (2... | geeksforgeeks | Medium | {
"class_name": "Solution",
"created_at_timestamp": 1618213656,
"func_sign": [
"public double[] findPoint(int A[], int B[], int C[])"
],
"initial_code": "//Initial Template for Java\nimport java.io.*;\nimport java.util.*;\nclass GfG\n{\n public static void main (String[] args)\n {\n \n ... | {
"class_name": "Solution",
"created_at_timestamp": 1618213656,
"func_sign": [
"findPoint(self, A, B, C)"
],
"initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n t = int(input())\n for _ in range(t):\n A = []\n B = []\n C = []\n input1 = [int(x... | eJy1lb1OxDAMxxlYmNiYrc7Xk53GbcOTIFHEADewlBvuJCQE4iHgfXFS+nGlaVLu6HCxnMj+xX/H93H+dXVx5r6bSzFuX5OnervfJdeQqKo2xgAhYlXb36EpO9YCJY4MQcvCCDkmK0g2L9vNw27zeP+83/3EkuNrdB/0ZlW/V3VK2O7g0J+8rWAAk0k2EKIMtGSC3GFIdpfe5ncAlkCMAkphF1w5RUDKA5XSZGYhmkbi1pvPgJLkVELJgliUFsJ6SAFlYvhImHUbXJdz4dWBFFafRgkgJwDbRQFLuVgDsyff9P102TGYGQQRQCFksqcl... |
701,399 | Reach a given score | Consider a game where a player can score 3 or 5 or 10 points in a move. Given a total score n, find number of distinct combinations to reach the given score.
Examples:
Input:
n = 10
Output:
2
Explanation
There are two ways {5,5} and {10}.
Input:
n = 20
Output:
4
Explanation
There are four possible ways. {5,5,5,5}... | geeksforgeeks | Easy | {
"class_name": "Geeks",
"created_at_timestamp": 1619173522,
"func_sign": [
"public long count(int n)"
],
"initial_code": "import java.io.*;\nimport java.util.*;\n\npublic class GFG {\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int t=in.nextInt();\n... | {
"class_name": "Solution",
"created_at_timestamp": 1627041237,
"func_sign": [
"count(self, n: int) -> int"
],
"initial_code": "# Initial Template for Python 3\n\nif __name__ == \"__main__\":\n for _ in range(int(input())):\n n = int(input())\n ob = Solution()\n print(ob.count(n))\... | eJyl000KwjAQBWAXPUjJukgmk6mtJxGsuNAu3MQuKgj+IHgFva+2tgulL0HtKhC+zJtheonu12jUfrPj8zA/qI2rdrWaxooKx1olsSr3Vbmqy/Vyu6u7u0nhzoVTpyR+B4IAWSBII2IRMZCQIMPQMBOOBpFlmE6gMqQzxAQXyziD1ZqMuDPLOKYHErNgKUjhiKFhaj1k9T/9ib8mmYALFR9+QLcL0FO4B0aCs/p+XC18bZK/d4t5Lz+j/JDFUBPE86fqLM0pTfPOL27jB1d1X1Y= |
702,105 | Word Boggle | Given a dictionary of distinct words and an M x N board where every cell has one character. Find all possible words from the dictionary that can be formed by a sequence of adjacent characters on the board. We can move to any of 8 adjacent characters
Examples:
Input:
N = 1
dictionary = {"CAT"}
R = 3, C = 3
board = {{C,A... | geeksforgeeks | Medium | {
"class_name": "Solution",
"created_at_timestamp": 1615292571,
"func_sign": [
"public String[] wordBoggle(char board[][], String[] dictionary)"
],
"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 ... | {
"class_name": "Solution",
"created_at_timestamp": 1615292571,
"func_sign": [
"wordBoggle(self,board,dictionary)"
],
"initial_code": "# Initial Template for Python 3\nif __name__ == \"__main__\":\n t = int(input())\n for _ in range(t):\n N = int(input())\n dictionary = [x for x in inp... | eJy9VN1u0zAUrgQSPManXA+kwrjhzkncOMWJI9vZGjBCbCuwG7OLTkJCoD0EvC0XnJMGsUpEI6WiceTKP+f7Oefk5v73ew9n/W/148Fs9upzchmvrjfJcyTzEJ+GqKTWBqfG6hxSWK9CPMYxrUNCQ4d4CgPLf2gfAjZED94UyRGS9aer9flmffHm4/VmCPuI4iZfjrCL9CzEpvPK1FiKE4rSph0a1SBrdOtoG3wAHTi2CZGOEdYJvQ1ToXP0EocWjsi0SEPks4ZPj/DocUL8+ic2T0KshLflCt6K2jXGSTIDZEdFkD5EixIrVmohmI1j... |
706,063 | Valid Pair Sum | Given an array of size N, find the number of distinct pairs {i, j} (i != j)in the array such that the sum of a[i] and a[j] is greater than 0.
Examples:
Input:
N = 3, a[] = {3, -2, 1}
Output:
2
Explanation:
{3, -2}, {3, 1} are two
possible pairs.
Input:
N = 4, a[] = {-1, -1, -1, 0}
Output:
0
Explanation:
There are no... | geeksforgeeks | Medium | {
"class_name": "Solution",
"created_at_timestamp": 1618397389,
"func_sign": [
"static long ValidPair(int a[], 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 Scanner... | {
"class_name": "Solution",
"created_at_timestamp": 1618397389,
"func_sign": [
"ValidPair(self, a, n)"
],
"initial_code": "# Initial Template for Python 3\n# Position this line where user code will be pasted.\n\nif __name__ == '__main__':\n t = int(input())\n\n for _ in range(t):\n n = int(in... | eJylk0EKwjAQRV14kE/WjjRNUxtPIhhxoV24qS5aEETxEHpMdx7AaRTRxVjbDiEEhv/4P5Och9f7cBBqduPD/KA2xa4q1RRK+4JX5As1gsr3u3xV5uvltipffe6cuHkc4VtkfUEWlIAMKAbpLgSNGAYJrCjWkrpukI5ADpSBJqAUPQ3VSCY6ZJgghWVjhg3KoMQKpPTlzSJiDJ+0nNAJjDgwuBD21mnMW99E0AIheRPIPjm2C4aNOC6eVL231JNrQZC0lFEHOYsp7TWFcG1/eo3/NhV+Xr+X/pGrjfJHfnnsDZduGl5N9tQLub03DdzF... |
711,153 | Number Of Islands | You are given a n,m which means the row and column of the 2D matrix and an array of size k denoting the number of operations. Matrix elements is 0 if there is water or 1 if there is land. Originally, the 2D matrix is all 0 which means there is no land in the matrix. The array has k operator(s) and each operator has two... | geeksforgeeks | Medium | {
"class_name": "Solution",
"created_at_timestamp": 1656394331,
"func_sign": [
"public List<Integer> numOfIslands(int rows, int cols, int[][] operators)"
],
"initial_code": "//Initial Template for Java\n\nimport java.util.*;\nimport java.lang.*;\nimport java.io.*;\n\n//Position this line where user code w... | {
"class_name": "Solution",
"created_at_timestamp": 1656441107,
"func_sign": [
"numOfIslands(self, rows: int, cols : int, operators : List[List[int]]) -> List[int]"
],
"initial_code": "# Initial Template for Python 3\n\nif __name__ == \"__main__\":\n T = int(input())\n for t in range(T):\n\n ... | eJzVVktuGzEM7aKb3uJh1kFA6jOfnCRApuii8aKbiRc2UKBIkEO0N8kul+ujpBk3aRTbTYAmlkaixuIj+UjJvv346/7Th/Q5v6Nw8aP5Nq23m+YMjY6TiizDOAk4DAOGYZyiIKZXtuA7yi7CxXHqIrqYNqTvY9aJ0pygWX1fr75uVpdfrrab2QocPAIiWnToMUAF43QzTs31CR66Y1j2uNkZgTlpkprk4Gzw4+RN8iYFBBvMI5OiSbSgkifT17zSvHJQlydqq88rTr4aQG6uNF9aKC2WVonpD4pjiaq45wQWqBd4TkEQZOG9FbScOkHH... |
705,631 | Queries on a Matrix | You are given a matrix of dimension n*n. All the cells are initially, zero.You are given Q queries, which contains 4 integersa b c d where (a,b) is theTOP LEFT cell and (c,d) is the Bottom Right cell of a submatrix. Now, all the cells of this submatrix haveto be incremented by one. After all the Q queries have been per... | geeksforgeeks | Medium | {
"class_name": "Solution",
"created_at_timestamp": 1615292571,
"func_sign": [
"public int[][] solveQueries(int n, int[][] Queries)"
],
"initial_code": "// Initial Template for Java\n\nimport java.util.*;\nimport java.lang.*;\nimport java.io.*;\nclass GFG {\n public static void main(String[] args) thro... | {
"class_name": "Solution",
"created_at_timestamp": 1615292571,
"func_sign": [
"solveQueries(self, n, Queries)"
],
"initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n T = int(input())\n for i in range(T):\n n, q = input().split()\n n = int(n)\n q = i... | eJzs2M1undeZpuEe9IFsaOwBKVGylXEdRAMtIINEg0wUD2wgQBCgTrDOqblJ/dmRV7ILq/qF73XhsmLV5o/Ij++j26j//N//5/1//cf/+r9/f/GXDz/+/NOLP1xe3L/7cH95/J+7y5MX311evP/bj+//9NP7P//xrz//9Om9Lu8+vPjHd5dffeDd3d2nj3379u31129+PADwe/f0Hw0AwO+cogNAgaIDQIGiA0CBogNAgaIDQIGiA0CBogNAgaIDQIGiA0CBogNAgaIDQIGiA0CBogNAgaIDQIGiA0CBogNAgaIDQIGiA0CBogNAgaID... |
703,441 | Roll the characters of a String | Given a string s containing lowercase alphabets and an array roll where roll[i] represents rolling the first roll[i] characters in the string, the task is to apply every roll[i] on the string and return the final string. Rolling means increasing the ASCII value of the character; for example, rolling z would result in a... | geeksforgeeks | Medium | {
"class_name": "Solution",
"created_at_timestamp": 1615292571,
"func_sign": [
"public String findRollOut(String s, List<Integer> roll)"
],
"initial_code": "import java.util.*;\n\nclass Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int t =... | {
"class_name": "Solution",
"created_at_timestamp": 1615292571,
"func_sign": [
"findRollOut(self, s: str, roll: list[int]) -> str"
],
"initial_code": "from typing import List\n\n\ndef main():\n t = int(input())\n for _ in range(t):\n s = str(input())\n roll = list(map(int, input().spli... | eJytVtuOmzAQ3Ye+7F+MeF5VsYFc9ksq1VUVwOEaQxJISKpq9yPa/+0YkwAJZsk2Yx6I8Jk5M3PsyfuXv2/PT5V9K/Hl+y8jFFmRG69gmEycyuPScT2+YsIGE+ZAgcAMpmAxoT74ARNz6CyEnY0JghATLLARNMOvCyaMFzB4mXE3597PtMjrcAHnq8qYCKM4WYs0w7fAX3HPdZYI+/0CLXYUwxzLw77Id9tNlop1Eket3XQK1AZqATWBUqDIYwJkAWQOZAZkCsQGYgExgWBOBMgEFkhP5mYjXVNmyoQksdnu8mJ/KI9NTh/iNCmeyn2+... |
705,133 | Arithmetic Number | Given three integers 'A' denoting the first term of an arithmetic sequence , 'C' denoting the common differenceof an arithmetic sequence and an integer 'B'. you need to tell whether 'B' exists in the arithmetic sequence or not. Return 1 if B is present in the sequence. Otherwise, returns 0.
Examples:
Input:
A = 1, B = ... | geeksforgeeks | Easy | {
"class_name": "Solution",
"created_at_timestamp": 1731402182,
"func_sign": [
"static int inSequence(int a, int b, int c)"
],
"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 Bu... | {
"class_name": "Solution",
"created_at_timestamp": 1731402182,
"func_sign": [
"inSequence(self, a, b, c)"
],
"initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n t = int(input())\n for _ in range(t):\n A, B, C = [int(x) for x in input().split()]\n\n ob = So... | eJxrYJm6m4UBDCK2ABnR1UqZeQWlJUpWCkqGMXkGCkCopKOglFpRkJpckpoSn19aApUuKSpNjcmri8lTqtVRQNdmiFtfWmJOMS6NhgYwoKCLzDaCs0l3DA4zDQkZic+d2A1SoJIzkZmkG6SLKxDJMcsSBhQQLEM4k4yQQxiDZLYuRUYaIgcYIYNweVaXYHpA10DIJgwLgPmCNBsIhgqGBuLUEe8AWFYm2gUEcwC6U4gObJwKY6foAQD3JWGl |
704,427 | Sum of Digits Divisibility | Given a number N. Check whether it is divisible by the sum of its digits or not.
Examples:
Input:
N=18
Output:
1
Explanation:
The sum of digits of 18 is 1+8=9
which divides 18.so, answer is 1.
Input:
N=25
Output:
0
Explanation:
The sum of digits of 25 is 2+5=7 which does
not divide 25, so answer is 0.
Constrain... | geeksforgeeks | Easy | {
"class_name": "Solution",
"created_at_timestamp": 1615292571,
"func_sign": [
"int isDivisible(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": [
"isDivisible(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.isDivisi... | eJxrYJn6j4UBDCK+AxnR1UqZeQWlJUpWCkqGMXlApKSjoJRaUZCaXJKaEp9fWoKQrANK1uoooOkwIFmLJQyQYRkMkK4VBkh3roW5mamJsRFunQa47DQyNjE1M7fA7VGcOmH+JN1SCpxqAPQqufZRZIYhzK9Qw8jyOARhcQ5qkiM95aBEJOHUgC/xkpFsUWzHl37xRS0Wk/B4DGwLmQmXcD4jlObJLRUQkU/Q6tgpegBBTYbi |
703,966 | Divisor Product | Given a number N, find the product of all the divisors of N (including N).
Examples:
Input:
N =
6
Output:
36
Explanation:
Divisors of 6 : 1, 2, 3, 6
Product = 1*2*3*6 = 36
Input:
N =
5
Output:
5
Explanation:
Divisors of 5 : 1, 5
Product = 1*5 = 5
Constraints:
1 <= N <= 10**9 | geeksforgeeks | Easy | {
"class_name": "Solution",
"created_at_timestamp": 1615292571,
"func_sign": [
"static Long divisorProduct(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 BufferedRea... | {
"class_name": "Solution",
"created_at_timestamp": 1615292571,
"func_sign": [
"divisorProduct(self, N)"
],
"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 = int(input())\n\n ob = Solution()\n ... | eJy9lE1OwzAQhVnAPSKvKxT/js1JKhHEArJgE7pIpUpVqx6CXpIdN2DiGJJUeQ4SAiuRInvmy8y8GZ+uzx83V3Gt3/njfi9ems22FXeFkFXDj1gVot5t6qe2fn583bbD4ZEPD6viwqP8WtDV60BlcJIAIvRLEySMLPJBQIKyHIAjFTIxeJ0NoDue9/XKWOlsxn2wyMYPAextNUnpAEBJQ8ZrZ3ANk4XGWZCzRivcAk4GLiBrCQg2ZYHrMLJY0nFZkyVJp7C40TMvuvYXv0i6akwwirz3ymXHZ9IB8ZWYKLtBQDjug+lANVRVU2lgrtH1... |
700,411 | Find perimeter of shapes | Given a matrix mat[][] of nrows and mcolumns, consisting of 0’s and 1’s. The task is to complete the function findPerimeter which returns an integer denoting theperimeter of sub-figures consisting of only 1’s in the matrix.For examplePerimeter of single 1 is 4 as it can be covered from all 4 side. Perimeter of double 1... | geeksforgeeks | Easy | {
"class_name": "GfG",
"created_at_timestamp": 1615292571,
"func_sign": [
"public static int findPerimeter(int[][] mat, int n, int m)"
],
"initial_code": "import java.util.*;\nclass Perimeter{\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint t = sc.nextInt();\n... | {
"class_name": null,
"created_at_timestamp": 1615292571,
"func_sign": [
"findPerimeter(arr, n, m)"
],
"initial_code": "# Driver Program\nif __name__ == '__main__':\n t = int(input())\n for i in range(t):\n n = list(map(int, input().strip().split()))\n arr = list(map(int, input().strip... | eJy1VMtKxTAQLSL6G0PWF5lJ+sIvEYy40C7cxLvoBUHuxY/Qr3VjpyltEjNiFrdDA3mcM2ceycfl18V1NX9331dVdf+uXtz+MKpbUGQdAQ9qB2p42w9P4/D8+HoYl/3aupN16riDGKRBz0g2AdoLUANmhW4mkJAWWGqomQWBfz8SJHOB00icDTTWIRSa4AUFJwQaM/HnTaqKFIFGoPOQmyjl+XEyLm/jFeCyTmuqlhkn2mxMtHIEv6BN+34k31s622KT/BZaLmSsgiI1sedYIwY45Lg7rzZus20FBXa5OUw7KzdSk/TQb2XEwBEmoinY... |
703,088 | Bitonic Generator Sort | Given an array arrthe task is to sort all even-placed numbers in increasing and odd-place numbers in decreasing order. The modified array should contain all sorted even-placed numbers followed by reverse sorted odd-placed numbers.Note: that the first element is considered as even because of its index 0.
Examples:
Input... | geeksforgeeks | Easy | {
"class_name": "Solution",
"created_at_timestamp": 1615292571,
"func_sign": [
"public static ArrayList<Integer> bitonicGenerator(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 ... | {
"class_name": "Solution",
"created_at_timestamp": 1615292571,
"func_sign": [
"bitonicGenerator(self, arr)"
],
"initial_code": "# Initial Template for Python 3\n\nif __name__ == \"__main__\":\n t = int(input())\n\n while t > 0:\n arr = list(map(int, input().split()))\n ob = Solution()... | eJydVElOw0AQ5AD/aM05Qt1eBpuXIGUQB/CBy5CDLSGxKI8I/023JyaBuOI4M96k6areqr2+/vm8uerXQ6cfyw/3Gldd6+7JSYhZiMK2SNyCXPO+ap7b5uXprWt3RmrxHaL7WtBfZK5IyigHsBzACnNIwv2dHgwoCkBR6kUF5eodBV0CqLegfzcAewCue7AFffwEVDWgEg6R6WgDFrMep5FdE7QcJXm6o4pqsvqigAwxTmVK0IJaPspRKZenqTILEkfSlJ6ghNLxOLaHC+ubJ0SGktGy+/kt0TVMxNAiqM3B+lyNz5R46sbcqpuvKY9D... |
702,693 | Perfect Array | Given an array arr[] of non-negative integers, determine whether the array is perfect. An array is considered perfect if it first strictly increases, then remains constant, and finally strictly decreases. Any of these three parts can be empty.
Examples:
Input:
arr[] = [1, 8, 8, 8, 3, 2]
Output:
true
Explanation:
The a... | geeksforgeeks | Easy | {
"class_name": "Solution",
"created_at_timestamp": 1617648096,
"func_sign": [
"public boolean isPerfect(int[] arr)"
],
"initial_code": "import java.io.*;\nimport java.util.*;\n\n//Position this line where user code will be pasted.\n\npublic class Main {\n public static void main(String[] args) {\n ... | {
"class_name": "Solution",
"created_at_timestamp": 1617648096,
"func_sign": [
"isPerfect(self, arr)"
],
"initial_code": "if __name__ == \"__main__\":\n t = int(input())\n for _ in range(t):\n arr = list(map(int, input().split()))\n solution = Solution()\n print(\"true\" if solu... | eJytVMEKwjAM9aD/EXoe0q6tW7168wsEJyI6QZA6dANBFD9C/9d062A7qCya5BDY8vJe2vTef04HvdJmE0zmF7azWZGzMTCRWAEhSFClS8wFC4Cl5yxd5+lmeShy/2t+LNLE3hLLrgG0Iapi1b2w6u38XfF2tT+9reZgIIaoe18NulYLnEJbcG+NzHij4EkkFKEa5xHmknIM1TlqGCFEjECCt6KcFX700v8tm8IYWYUcJAfFQdehHHMaluoE9vFutRT+NitjKHqIG+HugZtDOYSYIl0brSm9Map9Fv41oYAQapxcSiscVnPtvuxdE2rx... |
703,213 | Find element at a given Index | Given an array arr of integers and an index key(0-based index). Your task is to return the element present at the index key in the array.
Examples:
Input:
key = 2 ,
arr = [
10, 20, 30, 40, 50]
Output:
30
Explanation:
The value of arr[2] is 30 .
Input:
key = 4
,
arr = [10, 20, 30, 40, 50, 60, 70]
Output:
50
Explan... | geeksforgeeks | Easy | {
"class_name": "Solution",
"created_at_timestamp": 1708335711,
"func_sign": [
"public static int findElementAtIndex(int key, int[] arr)"
],
"initial_code": "// Initial Template for Java\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": 1708335514,
"func_sign": [
"findElementAtIndex(self, key : int, arr : List[int]) -> int"
],
"initial_code": "if __name__ == \"__main__\":\n t = int(input())\n for _ in range(t):\n key = int(input())\n arr = list(map(int, input().strip... | eJzNVclOwzAU5MCJrxjlXCE/29k48RlIBHGAHLiEHloJCVHxEfC/jJ2kjVK7LXShdl6WxjNvGef18/L79urCj7uSN/fvyUsznc+SGyRp1aiqSSEKkkIr6BSGvwgPaBhYcInmk0A0xECsWykZJK8awxeKIJqhWVpKy2g5raCVinS2akoUyJEhJaUhNT20zsXhCSea4GSCpH6b1k+z+vnxdT5bxbnwcfAsxl+sI154Fp6TjwkGeVnH63JYn7p1jH6SrSQbxpOLskDY6Kqj+oHVbST4NmwziNaEYpa2HBESCUGMJ1yXT7epay+hadPhzMCM... |
702,927 | Alternative Sorting | Given an array arr ofdistinct integers. Rearrange the array in such a way that the first element is the largest and the second element is the smallest, the third element is the second largest and the fourth element is the second smallest, and so on.
Examples:
Input:
arr[] = [7, 1, 2, 3, 4, 5, 6]
Output:
[7, 1, 6, 2, 5... | geeksforgeeks | Easy | {
"class_name": "Solution",
"created_at_timestamp": 1615292571,
"func_sign": [
"public static ArrayList<Integer> alternateSort(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 arg... | {
"class_name": "Solution",
"created_at_timestamp": 1615292571,
"func_sign": [
"alternateSort(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 ... | eJy1VdtKxEAM9UHwNw59XqSZW1u/RLDigxbxpe5DFwRR/Aj9X5NMuxY03a7owIaFnHOSOZPsvp1+9Gcnei7v+cvVc/HQb3dDcYGC2p5KOcUGRfe07W6H7u7mcTdMeU22/WvbFy8b/MREI0djrbHSmDRGjUGj1+g00mK9DJkJu5m8nxUJ81JWl1hxQ5DBjjm7QiEuOQVnkJ1ZmTnwCIhIqMB35y5AfBumeFAARVACVaAa1MBZ/TmmKUCAXghBiFEEkghVIliLcKMFrFvk95j8xPQo/oCz4zvu4eY08RXgSwTxEqlEVaLmWVD7uTH+yFUY... |
705,284 | Rotate Each Row of Matrix K Times | You are given an integer k and matrixmat.Rotate the elements of the given matrix to the left k times and return the resulting matrix.
Examples:
Input:
k=1, mat=[[1,2,3]
[4,5,6]
[7,8,9]]
Output:
[[2, 3, 1]
[5, 6, 4]
[8, 9, 7]]
Explanation:
Rotate the matrix by one
1 2 3 2 3 1
4 5 6 => 5 6 4
7 8 9 8 9 7
... | geeksforgeeks | Medium | {
"class_name": "Solution",
"created_at_timestamp": 1615292571,
"func_sign": [
"int[][] rotateMatrix(int k, 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 Buff... | {
"class_name": "Solution",
"created_at_timestamp": 1615292571,
"func_sign": [
"rotateMatrix(self, k, mat)"
],
"initial_code": "import math\n\nif __name__ == '__main__':\n t = int(input())\n for _ in range(t):\n n, m, k = map(int, input().strip().split(\" \"))\n mat = []\n for i... | eJztlkuOEzEQhlmw5BCfsh6huPzmJEgEsYAs2DSzmJFGQiAOAUdjx2Eot51MItmdhwZWk47S7i77/11fuTv+8fLXn1cv5s/b39p493X1ebq9v1u9YWU2k8djN5NBsDj8ZgpEEhmz1tsGIxiLcRiNmYCJmITJiMZFxwliEYdofHXDavtwu/14t/304cv9XfNRXarDZirCVA/VK7LsXfRG0WVvow5FmL3PZvquLt9uOM5CJfUbD/JgnAbLWSABiUhCMlbD1mBV1WIdVmkFbMQmbMZp2Bmc4NTV4Twu4CIu4TJew97gBW/xOiulHfARn/CZ... |
713,980 | Cutting Rectangles | Given arectangle of dimensions LxBfind the minimum number (N) of identical squares of maximum side that can be cut outfrom that rectangle so that no residue remains in the rectangle. Also find the dimension Kof that square.
Examples:
Input:
L = 2, B = 4
Output:
N = 2, K = 2
Explanation:
2 squares of 2x2 dimension.
I... | geeksforgeeks | Easy | {
"class_name": "Solution",
"created_at_timestamp": 1675773134,
"func_sign": [
"static List<Long> minimumSquares(long L, long B)"
],
"initial_code": "//Initial Template for Java\n\nimport java.io.*;\nimport java.util.*;\nimport java.lang.*;\n\nclass GFG{\n public static void main(String args[])throws I... | {
"class_name": "Solution",
"created_at_timestamp": 1675773134,
"func_sign": [
"minimumSquares(self, L, B)"
],
"initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n t = int(input())\n for _ in range(t):\n L, B = [int(x) for x in input().split()]\n ob = Soluti... | eJyNVEtKA0EQdSGeo5mliHT9uzyJYMSFZuFmzCIBQRQPofe1JxonCameqc00dPF4/T7zef4NF2fbub2sh7u37rlfbdbdTepg0UPeTRqP3VXqlq+r5eN6+fTwslnv1vdWFv3Hou/er1IMF6HsrUQoM7hMo3gxFSasaEgsasUjMMlCDIBc2Ig9eQDJ6Oxq6AmBjQspB5COSGTgxRUykGiDJrKACiWxUuopEk60qJMh5KIIQBRC/pOzJKTFsgNGTwdBxyoAZ3U3zcox0zqF0vCxSMrhUrHaQmItf+OITSfLf4eswWF7PyNpx/E/achkDmek... |
710,023 | Compute Before Matrix | For a given 2D Matrixbefore,the corresponding cell (x, y) of the after matrix is calculated as follows:
Examples:
res = 0;
for(i = 0; i <= x; i++){
for( j = 0; j <= y; j++){
res += before(i,j);
}
}
after(x,y) = res;
Input:
N = 2, M = 3
after[][] = {{1, 3, 6},
{3, 7, 11}}
Output:... | geeksforgeeks | Medium | {
"class_name": "Solution",
"created_at_timestamp": 1646061352,
"func_sign": [
"public int[][] computeBeforeMatrix(int N, int M,int[][] after )"
],
"initial_code": "//Initial Template for Java\nimport java.io.*;\nimport java.util.*;\n\nclass GFG {\n public static void main(String args[]) throws IOExcep... | {
"class_name": "Solution",
"created_at_timestamp": 1646061352,
"func_sign": [
"computeBeforeMatrix(self, N, M, after)"
],
"initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n T = int(input())\n while T > 0:\n N, M = [int(i) for i in input().split()]\n after... | eJzNVbuOFEEMJCDiK6yJb1C/3A++BIlFBLAByXDBnoSEQERkZPC/lN09tz0cvbusELob6daeV5XLLs/Xpz+/P3uify+/IXj1aXq/3N4dphc02d3CxLvFkqdI1pBF4injl1wgjyxqnCg4igZ3GrkgSaAiOeMuXEFC1vF0Q9P+4+3+7WH/7s2Hu8OKQw4IgZh2yxpFEqgaJcRrlElI1agg/rJbps83tGXtyQtrBqZSzORxwlkKTCkPWQRFYrxZUKw8Ls8OQFCngChhgbxXKOpzhVyughjygjyErYeUXotX/i0CSBPmjxyctAf/IIUNQBL2... |
701,226 | Count Inversions | Given an array of integers. Find the Inversion Count in the array. Two elements arr[i] and arr[j] form an inversion if arr[i] > arr[j] and i < j.
Examples:
Input:
arr[] = [2, 4, 1, 3, 5]
Output:
3
Explanation:
The sequence 2, 4, 1, 3, 5 has three inversions (2, 1), (4, 1), (4, 3).
Input:
arr[] = [2, 3, 4, 5, 6]
Output... | geeksforgeeks | Medium | {
"class_name": "Solution",
"created_at_timestamp": 1618205913,
"func_sign": [
"static int inversionCount(int arr[])"
],
"initial_code": "import java.io.*;\nimport java.util.*;\n\nclass Sorting {\n public static void main(String[] args) throws Exception {\n BufferedReader br = new BufferedReader... | {
"class_name": "Solution",
"created_at_timestamp": 1618205913,
"func_sign": [
"inversionCount(self, arr)"
],
"initial_code": "# Initial Template for Python 3\n\nimport atexit\nimport io\nimport sys\n\n# Modified to skip the first line\n_INPUT_LINES = sys.stdin.read().splitlines()\ninput = iter(_INPUT_LIN... | eJytVMtKxEAQ9KD/Ucx5kXTPTDLxSwQjHjQHL3EPWVgQl/0I9+bH2j2bDavQ0RH7UDSBqulHdfaXh4+rixy3B0nuXt3zsN6M7gaOuoEqCbQSCkmhUagVokJQ8AqsQG4F12/X/ePYPz28bMZJK8Ru2HWDe1vh6wsRhACGN4i1wfPCY0QEg+cNnrK88tCgRgJJe6USQhGm8lXHi2Jx2yR9B1ANkkYakEhILQRqpSJDjC0xrsCZylmGsyRneY6WWGUOqM6D9eZorZVkm8yOSTmlo2U05aNxNM1+Ka7s28iXVsftH2okX1Il/cYdhlsCptti... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.