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,466
Reducing Walls
You are given an arrayarr and an integer k. In one operation you can choose any element of array and decrease its value by k. You need find the minimum number of operation such that all the elements in the array becomes less or equal to k. Examples: Input: arr[] = [5, 3, 2, 6, 8] and k = 5 Output: 2 Explanation: Isha...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "public int reducingWalls(int[] arr, int k)" ], "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": 1615292571, "func_sign": [ "reducingWalls(self, arr, k)" ], "initial_code": "if __name__ == \"__main__\":\n t = int(input())\n while t > 0:\n arr = list(map(int, input().split()))\n k = int(input())\n ob = Solution()\n r...
eJy9VMtKxTAQdSH4G4eCuyLNO/VLBCMutAs38S56QRDFj9D/NZNYtNhJ6xXuKWSStpwzc5LJ2+lHe3aScXWeJtfPzUPc7cfmEo0IUXQE9ATkhShBlqBK0CWY/KMP0dCqadEMT7vhbhzubx/348SqQnwNsXlpMddSWcrlUZiim0dv8pwkQrQVasswC6m0sbBGKwkaUhH0Cr131kD00iuXBLx0CsZqp1INuiKkHadU/FoP6VeG25CHmuEvtjBj3feOSxkSChoGFg4etM8hSoZFcjQ/jkiqEfOD8/WZ42QzW3gm9yqV9tUUPQGOAEuAIUAT...
701,282
Check if a string is Isogram or not
Given a stringSof lowercase alphabets, check if it is isogram or not. An Isogram is a string in which no letter occurs more than once. Examples: Input: S = machine Output: 1 Explanation: machine is an isogram as no letter has appeared twice. Hence we print 1. Input: S = geeks Output: 0 Explanation: geeks is not a...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1619092569, "func_sign": [ "static boolean isIsogram(String data)" ], "initial_code": "/*package whatever //do not write package name here */\n\nimport java.util.*;\nimport java.lang.*;\nimport java.io.*;\nclass GFG\n {\n\tpublic static void main (String...
{ "class_name": "Solution", "created_at_timestamp": 1619092569, "func_sign": [ "isIsogram(self,s)" ], "initial_code": "# Initial Template for Python 3\n\ndef main():\n T = int(input())\n\n while T > 0:\n s = input()\n obj = Solution()\n if obj.isIsogram(s) is True:\n ...
eJytVdtOhDAQ9cHE39jwvDHenvwSE2tMabswK0xLL7uA0fgR+j2++V0WdjeSRcJtgZSGTM/pnDkdPs6/fi7O6uvh208eXwNA5WxwvwhuCdJQU0Z59SJoXMiFTqmVUVKoGBjBMmebEFNq+CqK1y9JthXaFg6kIhgsF4HIlWBW8Gfp7B71iuA7wevGGLwtFw3am4qW7Z56yoUHB4+eolSZNtZttnlRDmI4wr7zgDQMGePcz5BGmqYEHULmBEFlhONyN8aFkopqauNCS+Bg0h6+9tjOKwblUaWlqTOVnkpoRhNYaRpBAsYC8/Dgv3DJQFYx...
705,293
Is Sudoku Valid
Given anincomplete Sudokuconfiguration in terms of a 9x9 2-D square matrix(mat[][])the task to check if the current configuration is valid or not where a 0 represents an empty block.Note: Current valid configuration does not ensure validity of the final solved sudoku.Refer to this : https://en.wikipedia.org/wiki/Sudoku...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1729151386, "func_sign": [ "static boolean isValid(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 BufferedR...
{ "class_name": "Solution", "created_at_timestamp": 1729151386, "func_sign": [ "isValid(self, mat)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n t = int(input())\n for _ in range(t):\n arr = input().split()\n mat = [[0] * 9 for x in range(9)]\n ...
eJztVltKxDAU9cMFuISQ70FumkcbVyJYEdEKgnQGbUEQxUXoGvxzjaaZ2zZtUsEydTqjE2hzmpszObmP5PXw/fPowP5OP0zn7Ine5quyoCeEsjTnBIgi0jwTIswTTD+yb7clJHYQJwzfgL3KonrqBik7CpZZ4tf1qELE0GLdosaqbnFvPchIF4Rmj6vsqsiuL5ZlgVJuLu8esjR/SXP6vCDfa2R/QON0ftRb08gMAzds0nDEZm2azOzLCE0Sd6/1i8Jd1c5OavRLPZ50bMGuovYex/k1Y+TYqoYlchiF/bfay24cxIOaivtySFI/6GbX...
712,100
Majority Element II
You are given an array of integer arr[] where each number represents a vote to a candidate. Return the candidates that have votes greater than one-third of the total votes, If there's not a majority vote, return -1. Examples: Input: arr[] = [ 2, 1, 5, 5, 5, 5, 6, 6, 6, 6, 6] Output: [5, 6] Explanation: 5 and 6 occur...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1729431820, "func_sign": [ "public List<Integer> findMajority(int[] nums)" ], "initial_code": "import java.io.*;\nimport java.util.*;\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": 1729431820, "func_sign": [ "findMajority(self, arr)" ], "initial_code": "# Initial Template for Python 3\ndef main():\n t = int(input().strip())\n for _ in range(t):\n s = input().strip()\n nums = list(map(int, s.split()))\n ob...
eJxrYJk6lYUBDCL6gIzoaqXMvILSEiUrBSXDmDxDAzBQUNJRUEqtKEhNLklNic8vLYGpgEjH5NXF5CnV6iggaTbAoQVNGdAOYzBQMMRpiQJEBTZbgNotgQCXVpAcDm2GRjjtM8KlBU844NKCSwMO9QYKUIhDH057FCDQCA6NQRCHKTg9CNYHImFmGeM1B1eU4DAHt0G6uMLDklDs4opeagQgqSFoAHMwGe7FCDJDcsMenLTxJCGsQW1AQdoj18vGOL0G81vsFD0AgBNZFw==
702,688
Multiply Array
Calculate the product of all the elements in an array. Examples: Input: 5 1 2 3 4 5 Output: 120 Input: 10 5 5 5 5 5 5 5 5 5 5 Output: 9765625 Constraints: 1 ≤ N ≤ 10 1 ≤ A[i] ≤ 5
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1617647156, "func_sign": [ "public static int product(int arr[],int n)" ], "initial_code": "import java.util.*;\n\nclass GFG {\n\tpublic static void main(String[] args)\n\t{\n Scanner sc=new Scanner(System.in);\n int t = sc.nextInt();\n ...
{ "class_name": "Solution", "created_at_timestamp": 1617647156, "func_sign": [ "longest(self, arr, 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 arr = [int(x) for x in input().strip().split()]\n ob...
eJydU0EOgjAQ9KD/2PRMDC0tEK/efIGJGg/KwQtygMTEaHyE/tcFFBUypci2SZNmZnemw238WExG1bec82F1Foc0K3IxIyHXab2ERyI5ZckuT/bbY5F/7q98efGoAzIQZBDI502dGt6ceQy1S0OeKJbK+D5gUxUZBCukJuBF2oIMUUeeVJEdKxUCh6WHil4bEsQAHpVqNXdXfebDCZha009hC4wJQosQJyXuUoZraaeyVucUThulK0dPJLGxMJXf2XJPCzaoazL8i/96gGbAP/P8TpHqlRhrG0djksQUDcHmPn0Ch4KPbg==
715,408
Ticket Counter
N people from 1 to N are standing in the queue at a movie ticket counter. It is a weird counter, as it distributes tickets to the first K people and then the last K people and again first K people and so on, once a person gets a ticket moves out of the queue. The task is to find the last person to get the ticket. Examp...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1685427526, "func_sign": [ "public static int distributeTicket(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 ...
{ "class_name": "Solution", "created_at_timestamp": 1685707776, "func_sign": [ "distributeTicket(self, N : int, K : int) -> int" ], "initial_code": "t = int(input())\n\nfor _ in range(t):\n N, K = map(int, input().split())\n\n obj = Solution()\n res = obj.distributeTicket(N, K)\n\n print(res)\...
eJxrYJn6iIUBDCJuAxnR1UqZeQWlJUpWCkqGMXmGCkBCSUdBKbWiIDW5JDUlPr+0BCFdB5Ss1VFA02MAAng0mgKlcWk2UjDCqc+IgIVgCrdzodL4jLAEAfJMAGtVMMXrBHweh+g3MqVEv4WCCV4PmOJxvymBSAO5DJfdEL2E/Y4v7KBux+14sCJ8qYaYpIcrCZkS1Ehk3OEOAKjvsBpgQI0QJCr54fEDgcSH0/Fgq02Jcj1O2w3gyQ9qGpCD2yycaRG3FqXa2Cl6AKu8dc0=
702,761
Pair array product sum
Given an array arr[] of non-negative integers. Count the number of pairs {i, j} in the array such that arr[i] + arr[j] < arr[i] * arr[j].Note: the pair {i, j} and {j, i} are considered the same and i should not be equal to j. Examples: Input: arr[] = [3, 4, 5] Output: 3 Explanation: Pairs are {3, 4}, {4, 5}, and {3,5...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "public long countPairs(int[] arr)" ], "initial_code": "\nimport 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": 1615292571, "func_sign": [ "countPairs(self,arr)" ], "initial_code": "def main():\n t = int(input())\n for _ in range(t):\n arr = list(map(int, input().split()))\n solution = Solution()\n print(solution.countPairs(arr))\n ...
eJyllE1uwkAMhbug97BmjVCc+UnSkyA1iEWbBZuURZCQqlY9RDkiOw5RM5MgEngDKWNFjqL409h+9s9kd3h+8me+l5fXT7Wq15tGvZDisk7oaJpSsvI4NSVVbdfVW1O9Lz82TftjUdbfZa2+ptSPTiVGixkxK+YgwRiA4MQf6nzhT3B5cBlgcgKYIalzY4BABE0XhhKzNxI7pcRdUilAOUTyVTa+vhlJUaRYxEycEmtiQ2xR3xheTii50JxQje8/KpFG17Ihv8fc2Kr25dETTRac674i1SC0jQQhnVxVL/Xle18Hocgj+rqvCW44U8yx...
714,141
Yet another query problem
You are given an array of N elements and numqueries, In each query you are given three numbers L,R and K and you have to tell, how many indexes are there in between L and R(L<=i<=R) such that the frequency of a[i] from index i to n-1 is k. Examples: Input: N=5 num=3 A={1,1,3,4,3} Q={{0,2,2},{0,2,1},{0,4,2}} Output: 2 1...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1677669647, "func_sign": [ "public static ArrayList<Integer> solveQueries(int N, int num, int[] A, int[][] Q)" ], "initial_code": "import java.io.*;\nimport java.util.*;\nclass IntArray\n{\n public static int[] input(BufferedReader br, int n) throws I...
{ "class_name": "Solution", "created_at_timestamp": 1677669647, "func_sign": [ "solveQueries(self, N : int, num : int, A : List[int], Q : List[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 ...
eJy9VFFLw0AM9kHwb4Q+D7k0d13rLxGsKGgRX849dDAQxR+h/9ckvXYqzTk7cOnW612TL9+XZG+nHw9nJ/q5vOXF1XPxGDfbvriAAtuIro2+jSUQyBf51+uazxwEIDmroZSnRjYR1uCLFRTdbtPd9d39zdO2T/FqfqVswEEbX9tYvKzgB1hoY5AQAuU5+sxKgNALLm86ASbG9+JVCX4lp8FIANknMD45O4mSGVcSlZSnGCbzk4XRNJ1G0vECjPu0UA/8JBOLxySMxEIFXnlxKMZFU6HxEgJosTSpDd5DtdD0p5w0EgMOsiSNOOnCgmO1...
703,238
Valid Expression
Given a string s, composed of different combinations of '(' , ')', '{', '}', '[', ']', verify the validity of the arrangement.An input string is valid if: Examples: Input: S = ()[]{} Output: 1 Explanation: The arrangement is valid, as both the conditions are followed here. Input: S = ())({} Output: 0 Explanation: ...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "boolean valid(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 Scanner sc = new Scanner(...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "valid(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().strip()\n ob = Solution()\n if ob.valid(s):\n ...
eJzNVktOwzAQZcGWO0RZ2VKFwq8LToLkjlhAF2xCF62EZBlxCLgqOyTmYwe3ifNp3Qo7Su1annnz5nnij/Ovn4szbg/fODC2fKlXm3V5X5R3i1opY6x1DkBrnOFYKa1xjjOjLD5OAz64hhMa0h4cGwOAM9pVzopy+bZaPq2Xz4+vm7W3frWo3xd16l26WRFBuUV3lpw5sI6AsEuGpkF7nLIOQy6r1nvH2Q3HYIDRK22dQWfWoTs3aLwnhms2K02HhoaJN6XJuBtlfMfsHE1YJJyMIuWO6NEha4ojIA+SHnYHmimUaIREXMTlSdFVQ/Gy...
705,522
Pairs of Non Coinciding Points
In a given cartesian plane, there are N points. We need to find the Number of Pairs of points(A, B) such that Examples: Input: N = 2 X = {1, 7} Y = {1, 5} Output: 0 Explanation: None of the pairs of points have equal Manhatten and Euclidean distance. Input: N = 3 X = {1, 2, 1} Y = {2, 3, 3} Output: 2 Explanatio...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "static int numOfPairs(int[] X, int[] Y, 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": [ "numOfPairs(self, X, Y, 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 X = list(map(int, input().split()))\...
eJy9VbFOxDAMZWDgM6zOJ2Q3TRrY2PgEJIoYoMMt4YaehIRAfAT8L06a9jiubkl7EA91HNeJ37OT99PP67OTMG6uWLl9ydZus22yS8iocrpyBDkoKIBVzR/FU17IVpDVz5v6oakf75+2TfwFK/fGi68r2I9D6AO1kkdRoCqnoJXOSCPBKReiF36DbsBFN2DImOSamKX5hhbwxMB8xEp/UMgRFEKBoBEMQsneZdB0sKrg4cFNjK73YEhQBfg6xfZa2WtGJnS0XAayB8ubhuOEc3jdBvtyRExboH1hUixHJlOMpYVYtnIIrcSi94a2NOJX...
701,238
Count the number of possible triangles
Given an unsorted array arr[]of n positive integers. Find the number of triangles that can be formed with three different array elements as lengths of three sides of triangles. Examples: Input: n = 3 arr[] = {3, 5, 4} Output: 1 Explanation: A triangle is possible with all the elements 5, 3 and 4. Input: n = 5 arr[]...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1619364195, "func_sign": [ "static int findNumberOfTriangles(int arr[], 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 {...
{ "class_name": "Solution", "created_at_timestamp": 1619364195, "func_sign": [ "findNumberOfTriangles(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(...
eJylkkEOgjAQRV1wkEnXaKaUgvUkJmJcKAs36AISE2PiIfSI7jyEMyhRkqkI0tB00df/58+cg+s9GNXf/EaHxVFti31VqhkonRUmKzTQUiGo/LDP12W+We2q8n1DnUJoMzEzES3joSKJskQhIgibTxyld9gxYxD5OBFLnqYNxGAh8ZCpRLINTaAh0EIKjpamyHzV29gbmu6sWYyubpL9DopF26Zo56b0u76iyCkjmH6qL7uk2d9xi+UCMjqSPuKQ2jlsaeB8rRM7R9c/TNE23An8bmUsNqWZopTj6B0u038NYV3FgIloR4gDMmypxx3y...
869,905
Split an array into two equal Sum subarrays
Given an array of integers arr, return true if it is possible to split it in two subarrays (without reordering the elements), such that the sum of the two subarrays are equal. If it is not possible then return false. Examples: Input: arr = [1, 2, 3, 4, 5, 5] Output: true Explanation: In the above example, we can divid...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1720590537, "func_sign": [ "public boolean canSplit(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(new...
{ "class_name": "Solution", "created_at_timestamp": 1720562984, "func_sign": [ "canSplit(self, arr)" ], "initial_code": "if __name__ == \"__main__\":\n import sys\n input = sys.stdin.read\n data = input().splitlines()\n\n t = int(data[0])\n index = 1\n for _ in range(t):\n arr = l...
eJxrYJk6h5UBDCKmAhnR1UqZeQWlJUpWCkqGMXmGBmCgYAkGEMpCwUgBKKWko6CUWlGQmlySmhKfX1oC1ZSWmFOcGpNXB1RQq6OAapopxDBsFE7zSopKcRlnqGCMDZLlNCOgTlMFTNLQlCzjDBUwoSV5JkFjAJuJhuAIsbCgkhONyDIHmjTISxGGQI/BkAlZicBUAQGNyTPBABaKoIAmOyQpjGdINiBTI/mJlBIXg8MczRz8sYDfH4jUDixwoKUM+aGC3TRDKhhHmX7SHRM7RQ8APSCqBg==
703,975
Maximum Tip Calculator
In a restaurant, two waiters, A and B, receive n orders per day, earning tips as per arrays arr[i] and brr[i] respectively. If A takes the ith order, the tip is arr[i] rupees; if B takes it, the tip is brr[i] rupees. Examples: Input: n = 5, x = 3, y = 3, arr = {1, 2, 3, 4, 5}, brr = {5, 4, 3, 2, 1} Output: 21 Explanat...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1709467259, "func_sign": [ "public static long maxTip(int n, int x, int y, int[] arr, int[] brr)" ], "initial_code": "import java.io.*;\nimport java.util.*;\n\nclass IntArray {\n public static int[] input(BufferedReader br, int n) throws IOException {...
{ "class_name": "Solution", "created_at_timestamp": 1709467259, "func_sign": [ "maxTip(self, n : int, x : int, y : int, arr : List[int], brr : 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 ...
eJytVUEOgjAQ9GB8x6ZnY1qglfoSEzEelIMX9ACJidH4CP2bN7/ilgqCuhVEugVaujPtzrac+pfboJdf0yu+zPZsnWyzlE2AiSipGRsCi3fbeJnGq8UmS5/DjlHCDkOo+8rcK8A7CF4aNnm1TYBKTqAaBGnB4a28gkMzLung4vYhwAMfApCgYAwh6GIpGhtj7JT40cdBVJScJCXRO9xn6rYk2O9FiW/jYwuvC9NBh66zDikOlU8ZzaA/sAtkQ6YJwICcdGl5tKmEdq25lMqE7Wv9mKUkLXcRt01ERfIIMhUrRrorar8b6+D+IrZurLbw...
703,382
Multiply by 11
Given a number in the form of a string of length N . You have to multiply the given number by 11. Examples: Input: number = "8" Output: 88 Explanation: 8*11 = 88 Input: number = "12" Output: 132 Explanation: 12*11 = 132 Constraints: 1<= N <=10**6
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "String multiplyby11(String number)" ], "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...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "multiplyby11(self, number)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n t = int(input())\n for _ in range(t):\n number = input().strip()\n ob = Solution()\n pr...
eJytlE0OgkAMhV3oPcisiZnyN1MXnsNEjAtl4QZZDImJ0XgIva9kBhQMLUrsiqR8L319hdv0sZxNbK1U9bA+i0NelEYsPAFpLtNc+J7ITkW2M9l+eyxN3ZRV61p1L77XRYBEAAgESQSRQmgGpKYpDkOSAynpTYDr9oNBGMWJ0sjgYaxlECUKKRFsipvdFevAFe+jeYd384UZJrfBIGgX3Y2OODVl+Q8deidKh7HChFJ7nQbjhmJlrx/6eyOF4IdkB7fSTfkfO7JRj/noeocK2itvjzc+wFpc21ndP+99o/y1N7Kb+/wJsK+VXg==
701,170
Power of 2
Given a non-negative integer n. The task is to check if it is a power of 2. Examples: Input: n = 8 Output: true Explanation: 8 is equal to 2 raised to 3 (2 **3 = 8). Input: n = 98 Output: false Explanation: 98 cannot be obtained by any power of 2. Input: n = 1 Output: true Explanation: (2 **0 = 1) . Constrai...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1618809535, "func_sign": [ "public static boolean isPowerofTwo(int n)" ], "initial_code": "// Initial Template for Java\n\nimport java.io.*;\nimport java.lang.*;\nimport java.util.*;\n\nclass Driver_class {\n public static void main(String args[]) thr...
{ "class_name": "Solution", "created_at_timestamp": 1618809535, "func_sign": [ "isPowerofTwo(self, 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 ob = Solution()\n if ob.isPowerof...
eJy1VdtKxEAM9cEHP6PM8yJzbad+ieCIiFYQJC7agiCKH6G/5pv/YmZ02dW5tdtpaUOYlpxzkjR5O/z4Ojpw1+knOmfP5BbWQ09OKqIMUAPMADcgDEiyqkj3tO6u+u764n7ofz+7ubx77Ay8Gugfhn9O4B15WVV/QRjlwlnpLJ5wKhtn9XjM7VEeVO4qmyXLD4w3KqgNNJHAScapyNpAazOEDysdm9k6IGmGeWczsx6I7lUYbV0aZds1zrbWKloURW1U/KBI2mLONGu5zZ7QsV/E76CEE4DkQioEqpUStkaC0QYRec2ZtO3GJdcTajYe...
703,085
Swap kth elements
Given an array arr, swap the k**th element from the beginning with the k**th element from the end. Examples: Input: k = 3, arr = [1, 2, 3, 4, 5, 6, 7, 8] Output: [1, 2, 6, 4, 5, 3, 7, 8] Explanation: 3 **rd element from beginning is 3 and 3rd element from end is 6, so we replace 3 & 6. Input: k = 2, arr = [5, 3, 6,...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1708104239, "func_sign": [ "public void swapKth(int k, List<Integer> arr)" ], "initial_code": "import java.io.*;\nimport java.util.*;\n\nclass IntArray {\n public static int[] input(BufferedReader br, int n) throws IOException {\n String[] s = ...
{ "class_name": "Solution", "created_at_timestamp": 1708104239, "func_sign": [ "swapKth(self, k, arr)" ], "initial_code": "def main():\n import sys\n input = sys.stdin.read\n data = input().splitlines()\n t = int(data[0])\n index = 1\n while t > 0:\n t -= 1\n k = int(data[i...
eJzdVT1PxDAMZWDgZzx1viInqduaX4JEEQPcwFJu6ElIiBMDGyv8X5z7qNoerooO0Imotao4tt97cZqX04+3s5P1uHzVj6un5L5eLJvkAkmoakf6ejiGJ3hGIARGRsgYTGBGTsgZBaFglISSIQRhONJQrurUEVKGrtWpbqKqLmL+3UDa+f7h6WSGZP64mN8287ubh2Wz5XcAsdUosdVfEVuXSp5n6Oya2+yaCKSEFJA8opYMEiAe4pSHujcQFbSaEE0WDUeTR1NEU0YjbU2t9bWSURmrmFggLZG0bWi02ve00MfafzvEahmritco5WAC...
704,136
Minimum steps to delete a string
Given string s containing characters as integers only, the task is to delete all characters of this string in a minimum number of steps wherein one step you can delete the substring which is a palindrome. After deleting a substring remaining parts are concatenated. Examples: Input: s = "2553432" Output: 2 Explanation...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "public int minStepToDeleteString(String s)" ], "initial_code": "//Initial Template for Java\nimport java.io.*;\nimport java.util.*;\nclass GfG\n{\n public static void main(String args[])\n {\n Scanner sc = new Scan...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "minStepToDeleteString(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 ob = Solution()\n ans = ob.mi...
eJxrYJnqx8IABhHuQEZ0tVJmXkFpiZKVgpJhTJ6hko6CUmpFQWpySWpKfH5pCUJKqVZHAVWxkREpqg2NSDLc0IhU9cYmpmbmFpYGuHQZYNUGByRZZghyHm5NRliDC+hAE2MSwwyoB6SJNNcZQK0iyXn4NJjidBxuD2EPA5SYAtJ5JBoQE4MnYWDVAXGmoTEiBnBZaIxduwF+f5rgSOyYNsfEAO0mLSrRw8uI5AAzJSOWoAjuc8M8Q/wlQ+wUPQDFzUeA
706,340
Maximum GCD of siblings of a binary tree
Given a 2d list that represents the nodes of a Binary tree with N nodes, the task is to find the maximum GCD of the siblings of this tree without actually constructing it.Note: If there are no pairs of siblings in the given tree, print 0. Also, if given that there's an edge between a and b in the form of {a,b} in the l...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1617106233, "func_sign": [ "static int maxBinTreeGCD(ArrayList<ArrayList<Integer>> arr, int N)" ], "initial_code": "import java.io.*;\nimport java.util.*;\n\nclass GFG {\n public static void main(String args[]) throws IOException {\n BufferedRe...
{ "class_name": "Solution", "created_at_timestamp": 1617106233, "func_sign": [ "maxBinTreeGCD(self, arr, N)" ], "initial_code": "# Initial Template for Python 3\n\nfrom math import gcd\n\nif __name__ == '__main__':\n t = int(input())\n for _ in range(t):\n N = int(input())\n arr = []\n...
eJztV8tuU1EMZMEvILHDyrpC9/i8fPgSJIJYQBdsQhethIRAfAT8Lx7PTVMKF5GWvkQq1RPdJHN9xvY49+vj78+ePIq/l0/9xatPq/ebk7PT1QtZpfUmTf4vipDXG5WC0NabLIaAt4skjWj4uOi0OpLV8ceT47enx+/efDg7ndn8W1/Wm9XnI7l0i7reVOkIY73pklJEvzok5Ygdn5I0AtTfV88pE3AxS04Ev5iG5EroC6mkhVR0wqEqwogbl4iG3HDIGmmlIvggQJlRDci4aKI9ICv4IhWH4u+py1cDKu7jUAMaRJyk1YVs60K29Xe1...
703,439
Palindrome String
Given a string S, check if it is palindrome or not. Examples: Input: S = "abba" Output: 1 Explanation: S is a palindrome Input: S = "abc" Output: 0 Explanation: S is not a palindrome Constraints: 1 <= Length of S<= 2*10**5
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1730795833, "func_sign": [ "boolean isPalindrome(String s)" ], "initial_code": "import java.io.*;\n\nclass GFG {\n public static void main(String args[]) throws IOException {\n BufferedReader read = new BufferedReader(new InputStreamReader(Syst...
{ "class_name": "Solution", "created_at_timestamp": 1730795833, "func_sign": [ "isPalindrome(self, s: str) -> bool" ], "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() # Use lowercase 's'\n ob = Solu...
eJy1VD1PwzAQDRLwO06eK6SsbBkYujEiNai6OE6b4jiuP5q0FYgfAX+WiTREiAJJUzf1cCfZeu8+/O5eL98vrr36PHxced5kS1IhrSG3QPxQIBkBYaVk1LB4mlvTPBllWSheQkGeR7APUUgZRXU8MIAMBSBIXjuKAjncVzZryyJBrtvYMKI0cki/wsUsdocms3m6WKTzWXIyy9NANDwTuVwqbeyqKNebzbosVtZotZS5yPiZogRDhgkizqBADWNgilVWYwF3vJWqSxhjjHZIF2gj7YMi7w7vnxpf0doLRO6Ww38S+7puet35fS6Z70hd...
704,691
Array Pair Sum Divisibility Problem
Given an array of integers nums and a number k, write a function that returns true if given array can be divided into pairs such that sum of every pair is divisible by k. Examples: Input: nums = [9, 5, 7, 3], k = 6 Output: True Explanation: {(9, 3), (5, 7)} is a possible solution. 9 + 3 = 12 is divisible by 6 and 7...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1731230783, "func_sign": [ "public boolean canPair(List<Integer> arr, int k)" ], "initial_code": "import java.io.*;\nimport java.util.*;\n\npublic class Main {\n public static void main(String[] args) throws IOException {\n BufferedReader br = ...
{ "class_name": "Solution", "created_at_timestamp": 1731230783, "func_sign": [ "canPair(self, arr, k)" ], "initial_code": "def main():\n t = int(input().strip())\n for _ in range(t):\n arr = list(map(int, input().strip().split()))\n k = int(input().strip())\n\n solution = Soluti...
eJy1lNFKxDAQRX0Qv+PS50Umk0za+iWCFRGtIEhdtAuCCH6BT+7/elPXF9m4xq6BkhLamzP3ZvJ6uF4fHUzj9I0vZ8/V7bBcjdUJKtcNTjgcdk/doNUCVf+07K/G/vrifjVuVMaHVd8N1csC36WhAi8IAhNE4ZIVakQ4hWugIQn5iKAIDdcLdYxVwFkCUpukLGEFI1kizcjdXN49btXzcAh8DC0UkbOHdUNdqlPDBaiDNhMRi2thkUSh1GwPjfD8mziGukE7rZYCTWELdk/0oFS7gSMi+egcC1ajbyle0cCNc5H+gErfRJmmZ5aBSRoP...
702,683
Longest sub-sequence such that difference between adjacents is one
Given an array arr[]. The task is to find the longest subsequence such that the absolute difference between adjacents is one. Examples: Input: arr[] = [10, 9, 4, 5, 4, 8, 6] Output: 3 Explanation: As longest subsequences with difference 1 are, ("10, 9, 8"), ("4, 5, 4") and ("4, 5, 6"). Input: arr[] = [1, 2, 3, 2, 3,...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1617363189, "func_sign": [ "public int longLenSub(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...
{ "class_name": "Solution", "created_at_timestamp": 1617363189, "func_sign": [ "longLenSub(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 ...
eJzFVDtOxDAQpUDiGiPXK+RP7MScBIkgCkhBE7bISkgIxCHgCnTckedJIm2yO9kYChzl+T/z/Dzj9/PP74szLtdfaNy8qMd2u+vUFSlTt0ZzociFcrpqQ6p53jb3XfNw97TrBqNV3b7VrXrd0MwTbyebdpMDVlQAS/LAQAHoBZNBNGnxjehgz8NOSRX+gHaBMcwIVk0pmQVNoxPfRJZAFCxBMXoap44PZyoykk3CAmas8fOJJPZRYm9dAUbAgtExWkbDqBO6yFgxloyBUXRoFuQa9Ii0r11f68NhUNIgp0VX0oV7Td7QBC15R75gtIcj...
704,551
Even Fibonacci Numbers Sum
Given a number N find the sum of all the even valued terms in the Fibonacci sequence less than or equal to N.The first few terms ofFibonacci Numbersare, 1, 1,2, 3, 5,8, 13, 21,34, 55, 89,144, 233 ,… (Even numbers are highlighted). Examples: Input: N = 8 Output: 10 Explanation: There are two even fibonacci numbers l...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "static long evenFibSum(long 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 BufferedRe...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "evenFibSum(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.evenFi...
eJyllE0KwjAQhV3oGdxJyVokk2nSxpMIRlxoF25iFxUEUTyE3tdWa/0hMy3aRSmUb97Lm5mc+9fRoHd/ZsPyY34QG5/vCjGNBDgPUowjke3zbFVk6+V2Vzz/SedPzovjOPomKCSOaYRiEpsyEEUhporDKM5IYw0Bag5UOgHgjkejIFMLOsiqStV51ZYopMGQShwrYectpx+jeuDk6bGU0I9K+v5WukuGTRdeEqzDVoNMWytDzOQZwASD7IeFVgfEOJZF5J+d0l/d6lKMjfUVSmvAtSmjLALGGujd4Zc1vODNFIfH6LfEaiPvpn67D2Sn...
711,696
Pattern 13
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: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Constraints: 1<= N <= 20
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1662629863, "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": 1663245992, "func_sign": [ "printTriangle(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().strip())\n ob = Solution()\n ob.pri...
eJzs3c/ONdtV3eE0ciFLp+3GHvNf7eIScgWRYokGuEHn4IYtISFQrivXlQvI/I1ySIINgcjEx6YaHCxcdfi+Gu+7d61nzTXnf/2P//k//bf//h/+y9/+8Fc//vLXv/rhz84P+vmP8fnhZ+eHX/zNL3/xF7/6xV/++V//+lf/8787+1+e3H/W6TP7v6/zPffRZ/+jdBRHeVRHzf9hjq6j79F94nPCd8eJPFEn+sScuE58+T/fJz8ndXL/9XmyTvZJ/h/kdfJ78j71OaVTcSpP1Sn+P9Scuk59T92nP6d1Ok7n6f3j8d/3nL5Of0/fZz5n...
700,421
Maximum subset XOR
Given an array arr[] of N positive integers. Findan integer denotingthe maximum XOR subset value in the given array arr[]. Examples: Input: N = 3 arr[] = {2, 4, 5} Output: 7 Explanation : The subset {2, 5} has maximum subset XOR value. Input: N= 3 arr[] = {9, 8, 5} Output: 13 Explanation : The subset {8, 5} has m...
geeksforgeeks
Hard
{ "class_name": "Solution", "created_at_timestamp": 1615305726, "func_sign": [ "public static int maxSubsetXOR(int arr[], int N)" ], "initial_code": "import java.util.*;\n\nimport java.io.*;\nclass XOR\n{\t\n\tpublic static void main(String[] args) throws IOException\n\t{\n\t\tBufferedReader br = new Buff...
{ "class_name": "Solution", "created_at_timestamp": 1615305726, "func_sign": [ "maxSubsetXOR(self, arr, N)" ], "initial_code": "if __name__ == '__main__':\n t = int(input())\n for i in range(t):\n n = int(input())\n set = list(map(int, input().split()))\n obj = Solution()\n ...
eJylVE1LxEAM9SD+jtCbsMgkk8xM/SWCFQ+6By91D10QRPFH6P/1dbvVFZr9qHNp6CQveXnD+zj/Chdnm3NzieD2tXpqV+uuuqaKm9aaNjKxUaZIXC2oWr6slg/d8vH+ed1t8yIS35u2elvQ32ptWk7EQoXUqZXi1CaUG0UhQWOmmsxBSNFByACJtDM+hVMhMJyYgUGhpP0woAMuJB4bM58OB1AxcBkgM22mc5D6ZAfKeqjxkP1EMoYA34aUtpHbJYlILBp8BeuSk2kU7FGiWsqlpuFHqAsNH2S4HZCRSkmezlBJghYCYcV2oLel34U7...
703,245
Sort the string in descending order
Given a string strcontaining only lower case alphabets, the task is to sort it in lexicographically-descending order. Examples: Input: str = "geeks" Output: "skgee" Explanation: It's the lexicographically - descending order. Input: str = "for" Output: "rof" Explanation: "rof" is in lexicographically-descending or...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "String ReverseSort(String str)" ], "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 rea...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "ReverseSort(self, str)" ], "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 ob = Solution()\n print(ob.Re...
eJy1VUtOwzAUZMGGW0RZV0hsOQkSRSi/pvn4k8TOxwjEIeAK7LgjfoZCWuWldhtmFcn2+D3PvMnr5fvn1YXB3Yf+uH/yM8ql8G89/2ZN1dB3rRRNXXFGSVnk2TbdJHEUBmvqrzw/6XkSiSR+ZFL8nJo78qJPPa+8/TsCjVAj0og1Eo2NRqqx1cg00NtgETbBZjgEh4EEyIAUyJF7lVLDMPR917WtlEI0TV1XFeeMUUpIWRZFngMxkOLdOpFM1kEo41XdCNl2/aCCMIqTTbrN8qI8WDGtoHXMVDHSYOY9AiPBTgEjgdHAiGBUyAEFAK3D...
703,191
Consecutive Array Elements
Given an unsorted arrayarr. Find whether the array consists of consecutive numbers or not. Examples: Input: arr[] = [5, 4, 2, 1, 3] Output: true Explanation: All are consecutive elements, according to this order 1, 2, 3, 4 and 5. Input: arr[] = [2, 1, 4] Output: false Explanation: All elements are not consecutive....
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "public boolean areConsecutives(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 ...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "areConsecutives(self, arr)" ], "initial_code": "if __name__ == \"__main__\":\n t = int(input())\n while t > 0:\n arr = list(map(int, input().split()))\n ob = Solution()\n res = ob.areConsecutives(arr...
eJytU0sKwjAQdaH3GLIu0qRNP55EsCKiFQSJRVMQRPEQegB3HtOYESnaVBk7MLxkMZN5b15O3cut17ExvJrDaM+Wqig1GwDjmeK+DUhtICQIMULEPGD5rshnOp9P1qV+FutNmWfqmCl28KCuKVjg2AUvwl4SQkcQEICEECJIICaNZEbgJoXJwKR0NFlMV1tXF4nEJHKRyM9CiBAQJiOpQVGAukhCoRGZ/NrDI58rf3OnNafLmk0rFECpqnP0v5Z2sf2HnTG4FZ+7DNJcLOif97t6hiq0yjVtQ68q5dB/kVYtsK6uQ/r8t580Pvfv23ap...
703,131
Average of Prefix
Given an array arr, find the average or mean of the prefix array at every index. Examples: Input: arr[] = [10, 20, 30, 40, 50] Output: [10, 15, 20, 25, 30] Explanation: 10 / 1 = 10, (10 + 20) / 2 = 15, (10 + 20 + 30) / 3 = 20 and so on. Input: arr[] = [12, 2] Output: [12, 7] Constraints: 1 ≤ arr.size ≤ 10**5 1 ≤ a...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "public ArrayList<Integer> prefixAvg(ArrayList<Integer> arr)" ], "initial_code": "// Initial Template for Java\n\nimport java.io.*;\nimport java.util.*;\n\n//Position this line where user code will be pasted.\npublic class Main...
{ "class_name": "Solution", "created_at_timestamp": 1721808540, "func_sign": [ "prefixAvg(self, arr)" ], "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 arr = lis...
eJytVNsKgkAQDQqCvmLYZwldr/UlQRM9lA+9mA8KQRR9RP1vNmNplJqzrbJnZ9GzZ3fm7GV0m4wH1BbDYrA8ql2S5pmag3Iwebw2NehAZYGKD2m8yeLtep9nFccZE3Wy4JO4oqhG/Wlm1ID6iCFkCBj8/pw+q/EYXAZd369gu9r1/AAC33O1AxSEEFIIFEQCTsEvBun65RErgu5EMngMLoNmMFj3T9hTgN3gALGPWkxVj/p77F0polwrp68YOIitZ/b8UOB5RKHrX+IMdJHH9T9N3nj4LSVkVkOl6HIOmJsWw685bKgNs5qr38HCKqde...
703,305
Greater tower sum
There are some towers in stright line. You are given an array arr denoting the height of each tower. For tower p, the greater tower is the closest tower (towards the right), greater than the height of tower p. Return the sum of the heights of all tower's greater towers.Note: Return the answer by taking modulo 1e9+7.If ...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "public static int SaveGotham(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 ...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "SaveGotham(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 ...
eJytVEFOwzAQ5IB4x8jnCmXt2E54CVKDOEAOXEwPqYSEQDyi/QW3fpC1N2lDQSC7tRNNomhndya7/rjc7q4u0rr95Iflq3oKq/WgbqCoC1TFOy20aQk0Al7ACViBWsAIaFRqAdW/rPqHoX+8f14PIz1Tv3dBvS1wlNN2weCPncvHH6xIqAWcgBdoBIyAFqBR8/wtV4iO5kFzyTUsHDzYNuYCEUiDDKgGWZADeVADajl9QRJdxdBI4BOZTcQmJaGYsOXMniuwXInhiigziT10AU1mRJoiW+L//dWWfZWZhJ4vzHZmuIvl/JRHpfK6kBti...
703,406
Number of distinct subsequences
Given a string consisting of lower case English alphabets, the task is to find the number of distinct subsequences of the stringNote: Answer can be very large, so, ouput will be answer modulo 10**9+7. Examples: Input: s = "gfg" Output: 7 Explanation: The seven distinct subsequences are "", "g", "f", "gf", "fg", "gg" ...
geeksforgeeks
Hard
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "int distinctSubsequences(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 BufferedRea...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "distinctSubsequences(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 = o...
eJzll+tOgzAUgP3hA/gIC78X01MubX0SE2cMt21sXDcYoDHxIfR9PbDNRNMum1PY9IMfJIXSHr5zWl4u34Kri5ZbBy/unrQgTotcuxloMIrtUawNB5pfpb6b+95DUuSbRootz8PB59sfO0A5IiAgG5PtuJ4/nkyD2TyM4iTNFsu8WJVVre7JYkA4t4zDulPHCnSDAmOUyTv83UM5KmFQwgXIg4Y4iIt4iI+MkQkyRYKG2Yb5mhCJkBhJkiRNs2zRsmzJG4qiWCFlWVV1Xe/+ntTgTAdiCKlpdVWuiny5yNIkjsL5LJhOxr7nOnb/LcoZ...
704,162
Gold Mine Problem
Given a gold mine calledMof (n xm) dimensions. Each field in this mine contains a positive integer which is the amount of gold in tons. Initially the miner can start from any row in the first column. Froma given cell, the miner can move Examples: Input: n = 3, m = 3 M = {{1, 3, 3}, {2, 1, 4}, {0, 6, 4}}; Ou...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1616064428, "func_sign": [ "static int maxGold(int n, int m, int M[][])" ], "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": 1616064428, "func_sign": [ "maxGold(self, n, m, M)" ], "initial_code": "# Initial Template for Python3\n\nif __name__ == '__main__':\n t = int(input())\n for _ in range(t):\n n, m = [int(x) for x in input().split()]\n tarr = [int(x) f...
eJzlVsuO00AQ5MCNnyj5vELunp6H+RIkgjhADlzMHrISEgLxEfA93PguqnsfRCuaJNpFKyCOHHtmPFX9qIo/P/76/cmj+Dz/xosXH6a36/nFbnqGSTZrRd2sMqMUCL8VqlCBGKxBF3BKK8qALD5eNEYarKPOsDlGFMVQhCPTGabt+/Pt6932zat3F7srIJV5s37arNPHM/wCn09bdXyHCgq8JT6viSaBb4FPKO0onOrQ2UmVWFzmuM3wZRkJvjl+xQCD71jAyCCMFsJgea8IDpUTIxgmCE0SgI7uKIrOLRaH4WHcrIKced8Ch/njCGPn...
709,902
Find k-th smallest element in given n ranges
Given n ranges of the form [p, q] which denotes all the numbers in the range [p, p + 1, p + 2,...q]. Given another integer q denotingthe number of queries.The task is to returnthe k**thsmallest element for each query (assume k>1) after combining all the ranges.In case the k**th smallest element doesn't exist return -1....
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1650384796, "func_sign": [ "public static ArrayList<Integer> kthSmallestNum(int n, int[][] range, int q, int[] queries)" ], "initial_code": "import java.io.*;\nimport java.util.*;\n\nclass GFG{\n public static void main(String args[]) throws IOExcepti...
{ "class_name": "Solution", "created_at_timestamp": 1650384796, "func_sign": [ "kthSmallestNum(self, n : int, ranges : List[List[int]], q : int, queries : List[int]) -> List[int]" ], "initial_code": "class IntMatrix:\n def __init__(self) -> None:\n pass\n\n def Input(self, n, m):\n mat...
eJy9VEtOAzEMZcGCY1izLihO4swMJ0FiEAvogs3QSq1UCYE4BNyX5yQVQsht6Ydo1LiOP8/Oc97PP1cXZ3ndzCHcvjRP42y5aK6p4WHUj+reTKiZrmbTh8X08f55uVhb0TC+DWPzOqGfvr76evL1jzdDeCtIUD8ZRiF2EB2xVCVk78yAOL00kUkGo8gQKVAcxlhypFKpFdaOGAsi/ApQITJCYwtM0eV8wO9JD4WCGOFhk4h7eMLLyqQQnZau4Z1aQojiSARCgqZVTQtNp0IPDRwKCoY2qK2aYcehgSXEjlJM1MeojbQrX19QvRoPaJL7...
706,072
Restrictive Candy Crush
Given a string sand an integer k, the task is to reduce the string by applying the following operation: Choose a group of kconsecutive identical characters and remove them. Examples: Input: k = 2 s = "geeksforgeeks" Output: gksforgks Explanation: Modified String after each step: " g ee ksforg ee ks" -> "gksforgks"...
geeksforgeeks
Medium
{ "class_name": null, "created_at_timestamp": 1619365959, "func_sign": [ "public static String reduced_String(int k, String s)" ], "initial_code": "//Initial Template for Java\n\nimport java.util.*;\nimport java.math.*;\nimport java.io.*;\n\nclass FastReader{ \n\tBufferedReader br; \n\tStringTokenizer st;...
{ "class_name": "Solution", "created_at_timestamp": 1619365959, "func_sign": [ "Reduced_String(self, k, s)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == \"__main__\":\n t = int(input())\n for _ in range(t):\n k = int(input())\n s = input().strip()\n obj ...
eJyllktOwzAQhlmw4BiR1xXCvCQ4CRJBKA83DW2dtHXACQJxCLgqOyTGiYG4ZVxb/pxFF55/fs/Ek74dfnwdHfTcfMKP22dS8roR5DoiNOb0JOZJmuVsWszKhzHzXcgkIkzWLBMsv68aoWXG8b97Y/4ac/Iyicx8FzodkGdpItuua6VN19iIiJ4pUWOhisZC5M5BDkiBDMgBZWMKFMAMKAEkByJ6qkSVoBJTQkpE1WuxWC45r6q6Xq3W681GCD/hy8GtNqw9a9vaOWOWCuON6nraHql4Ah6BphECtdm15jZbzzKXB/fu8iDpr2IuNcMB...
702,783
Count of Subarrays
Given an array of N positive integers Arr1, Arr2 ............ Arrn. The value of each contiguous subarray of given array is the maximum element present in that subarray. The task is to return the number of subarrays having value strictly greater than K. Examples: Input: N = 3, K = 2 Arr[] = {3, 2, 1} Output: 3 Explan...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "long countSubarray(int arr[], int n, int k)" ], "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 Exce...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "countSubarray(self,arr, n, k)" ], "initial_code": "# Initial Template for Python 3\n# Driver code\nif __name__ == \"__main__\":\n tc = int(input())\n while tc > 0:\n n, k = map(int, input().strip().split())\n ...
eJylVMEKwjAM9aD/8ehZZOvWzvolghMPOsRL9bCBIIofof9rliHOadTNrKQdNK/vNUnP/asf9Nima1rMDmrjd0WuJlBh6kME5ILS1BAq2++yZZ6tFtsif2w6pV4dh2hGutK6RgcwqbdIMIYD/dFwtE5gBSRjBChDsQxYGwJGILNhDLx8LYGiUlUMI6qIhEANdrplGBGP+AagQWfzTIcjEXBiKwDZKh2Wo2X6oZOJuMqXCeA8EkxMpCRJ+isV+5mLlpLwpiAaAmNy7Yqk6pLXspcr/y3Az9slGe5PHazAdup5/MYp7Ejqzumpi9o+KzV+...
701,746
Minimum Cost Path
Given a square grid of size N, each cell of which contains an integer cost that represents a cost to traverse through that cell, we need to find a path from the top left cell to the bottom right cell by which the total cost incurred is minimum.From the cell (i,j) we can go (i,j-1), (i, j+1), (i-1, j), (i+1, j). Exampl...
geeksforgeeks
Hard
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "public int minimumCostPath(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 BufferedRea...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "minimumCostPath(self, grid)" ], "initial_code": "T = int(input())\nfor i in range(T):\n n = int(input())\n grid = []\n for _ in range(n):\n a = list(map(int, input().split()))\n grid.append(a)\n obj =...
eJzVlcFOwzAMhjlw4S2snidkJ2ni8CRIDHGAHbgMDpuEhBCceAJ4X/6ErlO1BOhWJFj3q3H6NXEdO3k5fn89Ocq/82c0Lh6b2+X9etWcUSPzJf4tczOjZvFwv7heLW6u7tar7jmezJfN04yG77R4jQxZcoRmi5uFKd/2VmYxtjSJzY5Rp09Dts1OtSGZpTSo6V/uG5URpPLtDt/DZJgsk8ujkGcKTAojwsXkJggxsAWQOAiU+NpUzlejnAZjgRBItlCevkXDQwFSKKIzTSkgBaSAlEQKSAEpIAWkJNIk50AakAakcRW/YvAVv1LoXIyQ...
702,789
Count Pairs in an Array
Given an array arr of n integers, count all pairs (arr[i], arr[j]) in itsuch that i*arr[i] > j*arr[j] and 0 ≤ i < j < n. Examples: Input: n = 4 arr[] = {8, 4, 2, 1} Output: 2 Explanation: If we see the array after operations [0*8, 1*4, 2*2, 3*1] => [0, 4, 4, 3] Pairs which hold the condition i*arr[i] > j*arr[j] are (...
geeksforgeeks
Hard
{ "class_name": "Solution", "created_at_timestamp": 1615833933, "func_sign": [ "static int countPairs(int arr[], int n)" ], "initial_code": "//Initial Template for Java\n\nimport java.util.*;\nimport java.lang.*;\nimport java.io.*;\n\nclass GFG\n{\n\tpublic static void main(String[] args) throws IOExcepti...
{ "class_name": "Solution", "created_at_timestamp": 1615833933, "func_sign": [ "countPairs(self,arr, 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...
eJxrYJlawcoABhGFQEZ0tVJmXkFpiZKVgpJhTB4QGcTkKekoKKVWFKQml6SmxOeXlkDlgTJ1QMlaHQUMTYYGQECyRiOoRgWytBookGerMcxWU/xWG+LRrwCEpIeTAUinATokyxwMU8h2j5GCsYKJgqmCmYK5goWCpYIheQ4yNADqtQCaYQY0ywRophEeFxmaEYhWbNFEXkwDY4p6UYUv8ClJh2SkQkjeISP1oIWrBTk244sjExNahrUJdQIbf8mBy+cghJSmjA1hbHgeIOiu2Cl6AG2PmgY=
704,594
XOR Game
Given a positive number k, we need to find a minimum value ofpositive integer n, such that XOR of n and n+1 is equal to k. If no such n exist then print -1. Examples: Input: k = 3 Output: 1 Explanation: 1 xor 2 = 3. Input: k = 6 Output: -1 Explanation: There is no such n, so that, n xor n+1 = k. Constraints: 1 ...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "static int xorCal(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 BufferedReader in = ...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "xorCal(self, k)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n t = int(input())\n for _ in range(t):\n k = int(input())\n ob = Solution()\n print(ob.xorCal(k))\n...
eJxrYJmqw8IABhGqQEZ0tVJmXkFpiZKVgpJhTJ6hko6CUmpFQWpySWpKfH5pCVTKKCavLiZPqVZHAVW9EQ71uoY4NJiQqsGUVA3mODQY41BvQaoFhricZI5LgxmpVhjjigdDU1w6SI4JQ7JcBtGFO5RxRwvJOkBWmZMZfMB0Q3IQgu3DGfIEQ4RMPwKJPHPSgxNmMRDhdjOuXAsJH6gRFriCFx5QsVP0AIvwUNQ=
701,743
Find whether path exist
Given a grid of size n*nfilled with 0, 1, 2, 3. Check whether there is a path possible from the source to destination.You can traverse up, down, right and left.The description of cells is as follows: Examples: Input: grid = {{3,0,3,0,0},{3,0,0,0,3},{3,3,3,3,3},{0,2,3,0,0},{3,0,0,1,3}} Output: 0 Explanation: The grid...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "public boolean is_Possible(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 BufferedRea...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "is_Possible(self, grid)" ], "initial_code": "T = int(input())\nfor i in range(T):\n n = int(input())\n grid = []\n for _ in range(n):\n a = list(map(int, input().split()))\n grid.append(a)\n obj = Sol...
eJxrYJk6jYUBDCL6gYzoaqXMvILSEiUrBSXDmDwQUtJRUEqtKEhNLklNic8vLYHKGsTkKdXqKGCoNyJFvRFQiwKQMFYwxqHNEJs2Y5A2oJ6YPAMFAwhlpGBAisVgE8BajSEGAfXjNAGrG0wgbjCAOh/hHCCEGkeagaZQT6GYBDLLGKsojElSeJtCvG2A4mwirCPFH6DQJTkNgD1EvFeAIjgtQVdKpDLcKRdTJcjVIIpIs6EZA0gCKVAIE5+nDCA2EelXWGga4s1SWG0hPphw5h6wrcTGCtgcQqEYO0UPAFkeWXI=
702,663
Mean of range in array
Given an array arrand q queries. Write a program to find the floor value of the mean in the range l to r for each query in a new line.Queries are given by an array of queries[] of size 2*q. Here queries[2*i] denote l and queries[2*i+1] denote r for i-th query. Examples: Input: arr[] = [1, 2, 3, 4, 5] and q[] = [0, 2, 1...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1618491866, "func_sign": [ "public ArrayList<Integer> findMean(int arr[], int q[])" ], "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": 1618491866, "func_sign": [ "findMean(self, arr, q)" ], "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 range(test_...
eJzFVEFOwzAQ5MCBZ4xy4NSitR3HMS9BoogD5MAl9JBKSAjEI+C/jF1QBcKJ44DodNtK8e7M7Lr7cvy2PjmKr4tT/rh8rO767W6ozlGpTc+3QDZ9tULVPWy7m6G7vb7fDYcTz3z4tMK3NBGZyIwnksn4+hFqmaJayEKor3yBTWgKE9QCK2gETtAKfFQdGxDra8IQNWGJhnBES3iM8E7UT1jWkcpGkkDAMooyNJSBqqEsVAPloFqaJkMQuj+VlsIcOzYv72nEk807RsOwjJphGJoRm5wmYEKifrBjaSV4MFE3RRtoH7wGp65EtUEWJm6G...
700,450
Merge k Sorted Arrays
Given k sorted arrays arranged in the form of a matrix of size k * k. The task is to merge them into one sorted array. Return the merged sorted array ( as a pointer to the merged sorted arrays in cpp,as an ArrayList injava,and list inpython). Examples: Input: k = 3, arr[][] = {{1,2,3},{4,5,6},{7,8,9}} Output: 12345 6 ...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1619160245, "func_sign": [ "public static ArrayList<Integer> mergeKArrays(int[][] arr,int K)" ], "initial_code": "//Initial Template for Java\n\nimport java.util.*;\nimport java.io.*;\n\nclass GFG{\n\tpublic static void main(String[] args){\n\t\tScanner ...
{ "class_name": "Solution", "created_at_timestamp": 1619160245, "func_sign": [ "mergeKArrays(self, arr, 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 numbers = [[0 for _ in range(n)] ...
eJztWMtuE0EQ5IDEjTPHks8R2nn1zPAlSBhxgBy4mBwSCQmB+Aj4X6p71tbueteK7YSAEiuSfYi7q6of1d6fz3+/fPXMXm9f8MO7b6vPm6ub69UbrNx6k9YbB4+AiARBRkGF6+AcnIcLcBEuwQlchitwFb6D53c8fICP8Gl1gdXl16vLj9eXnz58ubneRj83LtabH+vN6vsFxphdp6ADA2cN6ixcskCMwozCbJrLWxbR+H3woGF9hq+WiFkEviB0CIwYEBJCRqgIxB4RBKEgdogOkVwSYkasiMwSEQWxIHVIDolwElJGqkgeibQFqUA6...
705,187
Maximum sum of hour glass
Given two integers n, m and a 2D matrix mat of dimensions nxm, the task is to find the maximum sum of an hourglass.An hourglass is defined as a part of the matrix with the following form: Examples: Input: n = 3, m = 3 mat = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] Output: 35 Explanation: There is only one hou...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "int findMaxSum(int n, int m, 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 Buf...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "findMaxSum(self,n,m,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(\" \"))\n ...
eJytlMFuwjAMhneY9hxWzgjFadKuexIkMu0weuASOBQJadq0h4A34MZLzmkzRCEOBLU5xG2az/6d2L/P++PLU/fMDmTMv8TSrTeteAOB1hVQWCeBxnASExDNdt18ts3iY7Vpww5a/rFOfE8ggkHZPXAx5y8wzqv/bdchcFtikWryCwo6w0AJFbxaV5NvQARUDEnXjHTdSfdAbxPQOiJC7dUliaZkk2k8MYxwIP3ZnL4yTA5p+iClxwVq5C0TqvtUnhHkhZEKVd9WH64jDtXzt7Ni1d9GDtJ8MrMdxdOM8q5EI/JJua6vcvQCw7IHRyuM...
703,453
Search array with adjacent diff at most k
Given a step array arr[], its step value k, and a key x, we need to find the index of key x in the array arr[]. If multiple occurrences of key x exist, return the first occurrence of the key. In case of no occurrence of key x exists return -1. Examples: Input: arr[] = [4, 5, 6, 7, 6] , k = 1 , x = 6 Output: 2 Explana...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1729858496, "func_sign": [ "public int findStepKeyIndex(int[] arr, int k, int x)" ], "initial_code": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int t = ...
{ "class_name": "Solution", "created_at_timestamp": 1729858496, "func_sign": [ "findStepKeyIndex(self, arr, k, x)" ], "initial_code": "def main():\n import sys\n input = sys.stdin.read\n data = input().split()\n\n index = 0\n t = int(data[index])\n index += 1\n\n sol = Solution()\n\n ...
eJzNVU1vEzEQ5dBLb/yEpz2Xajy21za/BIkgDpADl6WHVEJCSPyI8n+ZN96kJWRTtkKUKOt1PF/vvZndfL/48fLyhX/eXNrm7dfh03RzuxteY4ibKQgUKfeNIAqSfTOyIGeMgjGjyGbKMIcgfZehGTH3ONuh2B0JxZ0iwojQoEo3rYgBMSEWTx2HKwzbLzfbD7vtx/efb3czlldhM+2v4dsVHsDUzVQRDNKvKA2i4SuCaoaRtYI6ETt0AoFHtlWRR4oeFUxOizmk57MMVpRVWZZ1WZiVBU1cGFvoGega6BvoHHoKpTDlIJ64fuISHqtN...
700,383
Multiply two strings
Given two numbers as strings s1 and s2. Calculate their Product.Note: The numbers can be negative andYou are not allowed to use any built-in function or convert the strings to integers. There can be zeros in the begining of the numbers. You don't need to specify '+' sign in the begining of positive numbers. Examples: I...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1616732531, "func_sign": [ "public String multiplyStrings(String s1,String s2)" ], "initial_code": "//Initial Template for Java\nimport java.util.*;\nimport java.math.*;\n\nclass Multiply{\n public static void main(String[] args){\n Scanner sc=...
{ "class_name": "Solution", "created_at_timestamp": 1616732531, "func_sign": [ "multiplyStrings(self,s1,s2)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == \"__main__\":\n t = int(input())\n for i in range(t):\n a, b = input().split()\n print(Solution().multiplyS...
eJyllE1uwjAQhbug97C8xshjx3+cBImgLtos2LgsgoSEWvUOhU1PWyc0sdswiaPOwpoomedv5tn5WFy/Hh/a2HyGZHume3841nRNqCw9AyFJoXTpjXWEAQcoPW+CCKnoktDqdKie6+rl6fVY/9Qxpbm1pX8P9cYZbVyb83alb0uS7NHJ3TRjikhjGqwvhCgCGB8gKtDHtEj8FkOC2FdMUSQ+CAxSyGBIY4ezRqtCChRRgJNCy8AYViW0G3egYSAseZiARdRcF6TPEKHute2HjfU8Y5T5k2T5pCwPdQQr98z+4kINuLt7hnV/K5ILnVeR...
704,180
Jumping Geek
Once there was a Geek he was quite intelligent and was also fond of jumping. But he jumped in a pattern like 1 leap, 2 leap, 3 leap and again from the start after 3rd leap. 1 leap means if Geek is at point P then he will jump to P+1. 2 leap means if Geek is at point P then he will jump to P+2. 3 leap means if Geek is a...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "static String jumpingGeek(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 BufferedReade...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "jumpingGeek(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.jumpi...
eJy1lE1qwzAQhbsIPYfR2hTLf6lykkAnZNF6kc04UBsaQkqz6wHa++bJqODKViwHxSDbsnmfNDNP87X4/X586K71GS8vR7HjfduIVSQkcSHiSFQf++q1qd62dduYX1wTfxKLUxz1BCmxxCgdokP13qn+npY6gxKAgnjpCXCAcmKw5DNxihDUTJgDim1l2F4OapZgKNBd2ZlCO5bAZstkAjmUqKkAx4qECJbpbWVCIqDGwmmX5tyTYhxjTYcWKDQ80bfClQujtYgjbgpqpz5QW8vMWepjoj/KMEaTXXKVmlvXnuvzYK63Y8/uHLxfrsny...
703,199
Longest Common Prefix of Strings
Given an array of strings arr.Return the longest common prefix among each and every strings present in the array. If there's no prefix common in all the strings, return "-1". Examples: Input: arr[] = ["geeksforgeeks", "geeks", "geek", "geezer"] Output: gee Explanation: "gee" is the longest common prefix in all the gi...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1731518152, "func_sign": [ "public String longestCommonPrefix(String arr[])" ], "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": 1731518152, "func_sign": [ "longestCommonPrefix(self, arr)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n t = int(input())\n\n for _ in range(t):\n arr = [x for x in input().strip().split(\" \")]\n\n ...
eJylVFFOxCAQ9UPvMeF7NemvJzFxjaFlmpBUbMrgrjEmHkKP4Z8HdBZq3d0w3aLTFB5h5jEDD97OP74uzqLdfDK4fVHW9YHUNahq7TTET61A4bbHhtDcPwYaHfTaqdcVHIXUjcEWcp1EEyezXFBDA0aIu6yE9Xk5SF0jxeo6F+tDjwPE9kG7CXTPCTpNYdCdQBldcqzWEQ6e/S16SAPCrtNDGjxZ3CREG+tQyjh6ZAsuOh3Qk8ERKOHpB2zt1oeWW0gDLo7B7vdIAhdPZrM6MMjiCUlpjlZSdUnF9R/FaPTBNViiB1okCCY7pbY5KY0u...
702,760
Sum of Middle elements of two sorted arrays
Given 2 sorted integer arrays arr1 and arr2 of the same size. Find the sum of the middle elements of two sorted arrays arr1 and arr2. Examples: Input: arr1 = [1, 2, 4, 6, 10], arr2 = [4, 5, 6, 9, 12] Output: 11 Explanation: The merged array looks like [1, 2, 4, 4, 5, 6, 6, 9, 10, 12]. Sum of middle elements is 11 (...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "public int SumofMiddleElements(int[] arr1, int[] arr2)" ], "initial_code": "// Initial Template for Java\n\nimport java.util.*;\n\n//Position this line where user code will be pasted.\npublic class Main {\n public static vo...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "sum_of_middle_elements(self, arr1, arr2)" ], "initial_code": "# Initial Template for Python 3\n\nimport sys\n\ninput = sys.stdin.read\n\n\ndef main():\n input_lines = input().strip().split(\"\\n\")\n t = int(input_lines[...
eJztWEuOHDcM9SI38AWIXhtBkfrnJAHiIItkFt6MvRgDBoIEOURyv+xyjTw+qtrtcVW54YztMRA1SKmrSIni50ndf3zz1z9Pn7B9/zcGP/x6enH76vXd6Ts5pee3KkmKNBmiKppEi2gTHc9vTbJU6aKLqIlm0SraxRYoLQv6RRIogwqoghqogwYIMi5ZIAlKoAwqoApqoA4axSWLS8p7n52Hp2dyunnz6ubnu5tffnr5+m5uxvDqd6ioz4aBkZ9+eyYXOzYaT+tpPu3nBpajN4NNDrrQXubGD/pd+ytf+g7WGTfNTwhLQWAaQjMYHDjF...
704,545
Number of ways
Given a value N. In how many ways you can construct a gridof size N x 4 using tiles of size 1 x 4. Examples: Input: N = 1 Output: 1 Explanation: We can arrange the tiles horizontally and this is the only way. Input: N = 4 Output: 2 Explanation: The first way can be when all the 1 x 4 tiles are arranged horizont...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "static long arrangeTiles(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 BufferedRea...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "arrangeTiles(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.arra...
eJydl7uOHkUQhQl4AAIyEmtjC1VXdV2aJ0HCiAAckBgHawkJgXgIeF++MwuyCGbRgmS8/v+Z7qpT51L7+6d/fvHZJ9d/X3/OD9/88vDju/cfHh++evWw3rxbD69fPbz9+f3b7x/f/vDdTx8eP37125t3D7++fvXv5/fN837z/NjNC1MeZbO84+ZVf2Fp8cLnx/j0fxd3++5teS9+o8/tK+W7O3bvnLuX5/blnV47IifvuuvT99We7OVn766w2eu4L3PfK8zb6tRE9cSUeZ3IvTpzbO3alvucaD8n/fBShm8eLuO8nLU6Js5k8rVvr7Ft...
700,410
Bipartite Graph
Given an adjacency listof a graph adj of V no. of vertices having 0 based index. Check whether the graph is bipartite or not. Examples: Input: Output: 1 Explanation: The given graph can be colored in two colors so, it is a bipartite graph. Input: Output: 0 Explanation: The given graph cannot be colored in two co...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "public boolean isBipartite(int V, ArrayList<ArrayList<Integer>>adj)" ], "initial_code": "import java.util.*;\nimport java.lang.*;\nimport java.io.*;\nclass GFG\n{\n public static void main(String[] args) throws IOException\...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "isBipartite(self, V, adj)" ], "initial_code": "if __name__ == '__main__':\n T = int(input())\n for i in range(T):\n V, E = map(int, input().strip().split())\n adj = [[] for i in range(V)]\n for i in ...
eJytVEsKwjAQddGDDFkXybcfTyIYcaFduIldtCCI4CH0eO48iJlWKNYEO2IXoSHvN5PPJbk9kln3Le/+Z3Vie1e3DVsAE9YJ4CwFVh3rattUu82hbYZFdk7hHS6pcD9wEBSOolkokJ0FliIpRA1qIGJURWEb0CM2RtE0CROSwGSxDvCQTgZ5QIfjVOPUoKKhJBNeTcayGUyevWxzKKwroLSuREfeg2NtCMb/3UxS3TpSBD2GToShog9ubX/UYyf9kzYRCfQ7yil4LMBhBX/ZCd+GiQ3o3xJPJd31L2/D+jp/AhQJc6s=
705,841
Fraction Trouble
Consider the set of irreducible fractions A = {n/d | n≤d and d ≤ 10000 and gcd(n,d) = 1}.You are given a member of this set and your task is to find the largest fraction in this set less than the given fraction.Note: The fraction that is given to you may or may not be irreducible.Example 1: Examples: Input: n = 1, d = ...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "public int[] numAndDen(int n, int d)" ], "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": [ "numAndDen(self, n, d)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n T = int(input())\n for i in range(T):\n n, d = input().split()\n n = int(n)\n d = int(d)\n ...
eJytlMFKxEAMhj3oe4SeF5nJJJ2JTyJY8aA9eKl76MKCKL6CoODjms4ssitmpgfnVOifr8mfv/N2/vl1cZbP9bs+3Dx3j9N2N3dX0PlhQnYgIsPUbaAb99vxfh4f7p5280Gi7/0iIBimV1W9bOAUwC4DbIIHdFax1oF3zpnFIkky3iIEYuhjMgEkkUBiZAvgkQC5twEJlwHZt2awh0iqSJUZJEXomYJtITkGCd5cgsdAwDUf0Dn1AdEcI+ipLzIr8qQWg4JHSD2h7WYUjVPvcAViVVNNYM7nD8rCMFEOmo/NnBxCZ6+7kRj4H6+zoqSm...
702,922
Alternate positive and negative numbers
Given an unsorted array arr containing both positive and negative numbers. Your task is to rearrange the array and convert it into an array of alternate positive and negative numbers without changing the relative order.Note: - Resulting array should start with a positive integer (0 will also be considered as a positive...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "void rearrange(ArrayList<Integer> arr)" ], "initial_code": "// Initial Template for Java\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": 1615292571, "func_sign": [ "rearrange(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 = Solution()\n...
eJytVctOw0AM5IDEb1g5d1H2kUf5EiSKOEAOXEIPqYSEkLhw4wj/i+31RqSJu6VqpMpW45nxesftx+XP19UFP7efmNy9Fc/9djcUN1DYTW9LfsCkZM0PGIklVFIg0TofqhrrY6yr4J0FE2OxgqJ73XaPQ/f08LIbkk5WJLEnMWFPYqIiYdMX7yuYngOpwbgSPIZAPAgqocHQolyUhlLpz/N7BrkIChGEFJGB4Uu6OBCYfwxOxIHxSIRHQx4wDfLggZUOGMKgkmCWgDQVymrKGspaytassNRLmqqN822JjrOGODmriZizitg5CyTBGfbb...
874,780
Kth Missing Positive Number in a Sorted Array
Given an increasing sequencearr[], we need to find the k-th missing contiguous element in the increasing sequence which is not present in the sequence. Examples: Input: arr[] = [2, 3, 5, 9, 10], k = 1 Output: 1 Explanation: Missing are 1,4, 6, 7, 8, 11, … So k-th missing element is 1 Input: arr[] = [1, 2, 3], k = 2 ...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1727102981, "func_sign": [ "public int kthMissing(int[] arr, 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 Buffe...
{ "class_name": "Solution", "created_at_timestamp": 1727119869, "func_sign": [ "kthMissing(self, arr, k)" ], "initial_code": "# Initial Template for Python 3\n\n# Main\nif __name__ == '__main__':\n t = int(input())\n while t:\n t -= 1\n A = [int(x) for x in input().strip().split()]\n ...
eJytlM1KxEAQhD3oexRzXmS6Z3o28UkERzxoDnoYdyELgig+hL6vPdlE/EkLcQ0M5JD6qK7qycvx2/bkaHjO7/Tl4tHdls2ud2dwlAshYA3yIAE1uUS3guseNt11391c3e/68dOUy3Mu7mmFr3pBQjPoI9jnkgx9a+jJe9V5BD1Rj3iFkHgDQ0IWCBHVTKtmcmELwNYg+whYEARRIJJLsCAhGJD1EAOBmwHDuTRL81AxIwREHUfnUbvEVhiWDdYsplq4xmmFYYdZEQpICApgayvYHAMzxSLVclvLTWtWM8IqIshfIXs//7BpaS6gunrp...
705,327
Total Decoding Messages
A top secret message containing letters from A-Z is being encoded to numbers using the following mapping: Examples: 'A' -> 1 'B' -> 2 ... 'Z' -> 26 Input: str = "123" Output: 3 Explanation: "123" can be decoded as "ABC"(123), "LC"(12 3) and "AW"(1 23). Input: str = "90" Output: 0 Explanation: "90" cannot be decod...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1729449093, "func_sign": [ "public int countWays(String s)" ], "initial_code": "// Initial Template for Java\n\nimport java.io.*;\nimport java.lang.*;\nimport java.util.*;\n\nclass GFG {\n public static void main(String[] args) throws IOException {\n ...
{ "class_name": "Solution", "created_at_timestamp": 1729449093, "func_sign": [ "CountWays(self, str)" ], "initial_code": "# Initial Template for Python 3\n\nimport sys\nsys.setrecursionlimit(10**6)\n\nif __name__ == '__main__':\n T = int(input())\n for i in range(T):\n str = input()\n ...
eJyVk00OgkAMhV1wEDJrYmhn+PMkRjHGKAs3IwtISIyJh9D7CsxIjGkJHTZd8L1589o+g/cpWI1nu+uL/V1dbd02ahMqKC1MR0Whqrq6OjfV5XhrG/9PXpRWPaLwD4u/H4MBSaE2SZrlBUfFJAWAoMFAwlAJUhjGCIio0TAYprRHdxekDGZIk7IXiUITRYyZTFvm2/ePYTTNyLotTBK1v0NszM3HUNhpUrhRyWcExtB/VGZkgE5Iu1Vy/RiqBVNIp+FlaFNz60pvUK+gF71roA+v9Qdg5Uu5
700,266
Replace all 0's with 5
Given a number N. The task is to complete the function convertFive() whichreplaces all zeros in the number with 5 and returns the number. Examples: Input: 2 1004 121 Output: 1554 121 Explanation: Testcase 1: At index 1 and 2 there is 0 so we replace it with 5. Testcase 2: There is no,0 so output will remain the s...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1617624440, "func_sign": [ "public static int convertFive(int n)" ], "initial_code": "import java.util.*;\nclass Replace{\npublic static void main(String[] args){\n\tScanner sc=new Scanner(System.in);\n\tint t=sc.nextInt();\n\twhile(t-->0){\n\t\tint n=sc...
{ "class_name": "Solution", "created_at_timestamp": 1617624440, "func_sign": [ "convertFive(self,n)" ], "initial_code": "if __name__ == '__main__':\n t = int(input())\n for i in range(t):\n n = int(input())\n print(Solution().convertFive(n))\n print(\"~\")\n", "solution": "cla...
eJy1VLFOxDAMZUB8R5X5hJw0ThO+BIkgBujAEm64k05CVHwE/CgbG07SnKBXt70DMlSWar882+/l9fz98+IsnesPCm6exWNYbzfiqhK1DxIk+IAA6IMFsGJViXa3bu837cPd03bTZ0qUlNBRJp0UWESbAvGyqr5hasJUNX3RNJTgQCofao3AIafkruRT4DCWdKkKx65QkTadiE6HpVyoun00AMIEJH1QAJElAE1EA+g8ER5YJjSF2BNFrFNAhPXPMQ1ulBGZnQVXReAGwPjQADSTezKIJiE0iM3knlTakw8Te8mdMG0457hS+jVapePC...
701,427
Sum of all substrings of a number
Given an integer s represented as a string, the task is to get the sum of all possible sub-strings of this string.As the answer will be large, return answer modulo 10**9+7. Examples: Input: s = "1234" Output: 1670 Explanation: Sum = 1 + 2 + 3 + 4 + 12 + 23 + 34 + 123 + 234 + 1234 = 1670 Input: s = "421" Output: 491...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1617873884, "func_sign": [ "public static long sumSubstrings(String s)" ], "initial_code": "//Initial Template for Java\n\n/*package whatever //do not write package name here */\n\nimport java.io.*;\nimport java.util.*;\nclass GFG {\n\tpublic static void...
{ "class_name": "Solution", "created_at_timestamp": 1617873884, "func_sign": [ "sumSubstrings(self,s)" ], "initial_code": "# Initial Template for Python 3\nimport atexit\nimport io\nimport sys\n\nimport sys\nsys.setrecursionlimit(10**6)\n\n# Contributed by : Nagendra Jha\n\nif __name__ == '__main__':\n ...
eJydk00KwjAQhV30ICXrIplMmjSeRLDiQrtwE7toQfAHD6H3ta20RfCl2FkFMl/e42XmEb2u0aKrdd0cNhdx9GVdiVUsKPckklgU57LYV8Vhd6qr8eqee3FL4u9+B/od6kcAkQUISQkZZKthQhTkXFuIU6w5RYJDAZotWa2ky9ADCskiyZBTpaEM69TYDKLGmtSygqJ9SOGPkTDgzgN2/huUc8cACjEbPDqBuW60JqORwytzEqLgMDCiWhCrwVBz/9mVP9kxp37Zpj2MyW2fyzf1QWBG
703,474
Smallest greater elements in whole array
Given an array A of N length. We need to calculate the next smallest greater element for each element in a given array. If the next greater element is not available in a given array then we need to fill -10000000 at that index place. Examples: Input: arr[] = {13, 6, 7, 12} Output: _ 7 12 13 Explanation: Here, at in...
geeksforgeeks
Easy
{ "class_name": "Complete", "created_at_timestamp": 1615292571, "func_sign": [ "public static int[] greaterElement(int arr[], int n)" ], "initial_code": "//Initial Template for Java\n\n//Initial Template for Java\n\n//Initial Template for Java\n\n/*package whatever //do not write package name here */\n\ni...
{ "class_name": null, "created_at_timestamp": 1615292571, "func_sign": [ "greaterElement(arr, n)" ], "initial_code": "# Initial Template for Python 3\n\nfor _ in range(0, int(input())):\n n = int(input())\n arr = list(map(int, input().strip().split()))\n res = greaterElement(arr, n)\n ans = \...
eJy9lM9Kw0AQxj0IvsZHzkV2Z7ObrQdvvoNgJAftwUvsoQVBFB9C39dvNqkWcdpU0YaGhJ3fNzOZPy/HbxcnR+V3ec6Hq8fqrl+uV9UZKt/23rV9hBdkJAR4Pjv4Gg2kmqFaPCwXN6vFbXe/Xo1Q0mMaNYjolCSTibb9c9tXTzN8cSBtL5TMNCc6h6e00J4iAXz1hh8a0TrRZMA7ElFp75W03MW2Dw4SIQyK9xqSUDsEgcwRmKRH4FGDUCMEwzmNiA3AoNXRGFRWUIpg0aeIEUlmMBgS1cwbZCvRbRv6sTJz+neYO2R+fYfkEF2JxJVP...
700,245
Largest subarray of 0's and 1's
Given an array of 0s and 1s. Find the length of the largest subarray with equal number of 0s and 1s. Examples: Input: N = 4 A[] = {0,1,0,1} Output: 4 Explanation: The array from index [0...3] contains equal number of 0's and 1's. Thus maximum length of subarray having equal number of 0's and 1's is 4. Input: N = 5 A...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1731322758, "func_sign": [ "public int maxLen(int[] arr)" ], "initial_code": "import java.io.*;\nimport java.util.*;\n\npublic class Main {\n public static void main(String[] args) throws IOException {\n // Create BufferedReader for efficient i...
{ "class_name": "Solution", "created_at_timestamp": 1731322758, "func_sign": [ "maxLen(self, arr)" ], "initial_code": "# Initial Template for Python 3\n\nt = int(input())\n\nfor _ in range(0, t):\n a = list(map(int, input().split()))\n s = Solution().maxLen(a)\n print(s)\n", "solution": "# Back...
eJxrYJk6j40BDCKmAxnR1UqZeQWlJUpWCkpGMXlmMXmGCgZAaAiEBkAOEIM4UAEYraSjoJRaUZCaXJKaEp9fWgI1wABsgFKtjgKqqRYgU5G0g002ApmMZi6Exm26BTbTDU0xjEe3zMgA4i9kDJNG5hvgs9zQBMN2Y4g/DOH2ohgHCz6ITUh2QMzC5lZDQiEADjYMdwBNNDYgEApYaCRbcduIaZWhAUiYWA24jMY014gkc4EaTEnVAHQ5KTpgiQu3BoJRgTcuaJV8KI1j4rMsNDFQlHVpYRvueCE+3UKdAAtu4pIxTBdxqqElLpJvMUte...
700,291
Toeplitz matrix
A Toeplitz (or diagonal-constant) matrix is a matrix in which each descending diagonal from left to right is constant, i.e., all elements in a diagonal are the same. Given a rectangular matrix mat,your task is to complete the function isToeplitz which returns true if the matrix is Toeplitz otherwise, it returns false. ...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "boolean isToeplitz(int mat[][])" ], "initial_code": "import java.util.*;\n\nclass Check_IsToepliz {\n public static void main(String args[]) {\n Scanner sc = new Scanner(System.in);\n int T = sc.nextInt();\n ...
{ "class_name": null, "created_at_timestamp": 1615292571, "func_sign": [ "isToeplitz(mat)" ], "initial_code": "# Your code goes here\nif __name__ == '__main__':\n t = int(input())\n for i in range(t):\n n, m = list(map(int, input().strip().split()))\n arr = list(map(int, input().strip(...
eJxrYJnqwsYABhG2QEZ0tVJmXkFpiZKVgpJhTJ6hAohQ0lFQSq0oSE0uSU2Jzy8tgcqXFJWmxuTVxeQp1eoooOozUjACaTZSMFYgXzdIvxEO3WmJOcW4tBvDLIdisowwgbnfRMFUAcKyhLBI948hkmmk6zZRgEQECJKu21TBNCbPUsFCwVzBDOx+GNsIzjaGs01gbHLizBQzxEwVzMgKfGOEUSDaFERT0evU9jsstVhiSy4gh1AhEePyPz4ziIh7agUAthijyMk0dzPOwDEkyyZ8nkLKwRQUh+DClOqxis/d0HKL2IIrdooeAAxxwHk=
703,484
Positive and negative elements
Given an array arrcontaining equal number of positive and negative elements, arrange the array such that every positive element is followed by a negative element.Note:The relative order of positive and negative numbers should be maintained. Examples: Input: arr[] = [-1, 2, -3, 4, -5, 6] Output: [2, -1, 4, -3, 6, -5] ...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1617554625, "func_sign": [ "ArrayList<Integer> arranged(ArrayList<Integer> 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[]) t...
{ "class_name": "Solution", "created_at_timestamp": 1617554625, "func_sign": [ "arranged(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 a...
eJy9V0uuJDUQZMEJOIHV6xnUmU7/uAcSEg+xgFmweczijTQSGsQh4L44M8O2Ek2NGgmmpbad71VFZEVEVbn/+PKvp6++sM93387F97/dfnl+++7l9k260dPza7rbJw37pNeY8efbq3R78/7tm59e3vz846/vXnDiOnidvGac/fT8+9Pz7cOr9BGuRH5aYswZs2AumCvmhrljBu3kvGjuvyPwxdXVFL9mmyanzexlRileFpTVy4ayezm8JIciuriswHOPPBx5JPLUwANaokV7dX0rCXC1q6C2aiqpraqKaquistpKVFhbZZXWVqzi2orS...
702,691
Maximum Sub Array
Find out the maximum sub-array of non negative numbers from an array. Examples: Input: n = 3 a[] = {1, 2, 3} Output: 1 2 3 Explanation: In the given array every element is non-negative. Input: n = 2 a[] = {-1, 2} Output: 2 Explanation: The only subarray [2] is the answer. Constraints: 1 ≤ N ≤ 10**5 -10**5 ≤ A[i] ≤...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "ArrayList<Integer> findSubarray(int n, int a[])" ], "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 ...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "findSubarray(self,n, a)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n tc = int(input())\n while tc > 0:\n n = int(input())\n a = list(map(int, input().strip().split())...
eJytVMFKxDAQ9aCfITyCxx2ZtOlu9UsEKx60By91D10QRNmPWP/XTLIK0rxqwaaQQmbezHtvmv3px8XZSXpuzuPH7at7Gra70V3D+W6IrzRuBde/bPuHsX+8f96Nx2Px6Ib3bnBvK0yylCQpzdFYykMhFWo0kBZVWuIJlEXNgHkYUIhBa2zQ4gqeNVUKZdCNoaOKfdaKoGgYaDpjKGvrT6xuois15UgAgqllYuVGJLA2uEutMdHUhWbZbYs62BYoK8ppY7OC/GpedAjympXY6H1vzLgyhnwJVLHEQg5jXAhlf8RvTumcUYRKu6RWae5j...
705,646
Traverse All Edges And Vertices
You are presented with an undirected connected graph consisting of n vertices and connections between them represented by an adjacency matrix. Your objective is to determine whether it is possible to start traversing from a node, x, and return to it after traversing all the vertices at least once, using each edge exact...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "public int isPossible(int[][] paths)" ], "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\...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "isPossible(self, paths)" ], "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 paths = []\n for _ in range(n):...
eJzVVk1LAzEQ9eDZ3xBy8NRKRtFWf4lgxIPuwcvawxYEEfwR+n/dxMnmTeJCE/qx7ULZGZJ5bz7esF+nP/OzE/+7P+9fHj70a7tad/pOabLtjW2Nov4x7rGte2HTGX9+coYJhxQ5I5hs8C09U7p5XzXPXfPy9LbuGKi/rj9nSkIvQkzGFOARUbARfAyaFEmEUIFXEatlLIgoSqQqHFAcgEzwsXz0L38sYwXpW2QwIIiSIPGMunCmsUwai7tlIGNAFCcxKz5dkhcZOSMZEKW0szJnrjTn4XqaosHGQo3ynGB4RVTZdf4vyf/SR/CxS65d...
703,125
Find the number of tabs opened
You are given an array arr[], where each element is either a tab ID or the string "END". If a tab ID appears, toggle its state (open if it's closed, or close if it's open). If "END" appears, close all open tabs. Your task is to determine the number of tabs that remain open after all operations are completed. Examples: ...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1616523261, "func_sign": [ "public int countTabs(List<String> 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\npublic class Main {\n public st...
{ "class_name": "Solution", "created_at_timestamp": 1616523261, "func_sign": [ "countTabs(self, arr)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == \"__main__\":\n t = int(input().strip())\n for _ in range(t):\n s = input().strip()\n arr = s.split()\n ob ...
eJy9lcGKwjAQhj0IvsaQs0iTaGs9r9eeF7biQXvw0u2hwoIo+xD6ht72JTbJWBOCsXZEC4FpSv75+mcm+e2f/gY983yeVfC1Y5uy2tZsBoznJQcBEsYwgXn2AVzFGAk1F+uIDYEVP1Wxqov18ntbX5ZGeXnIS7Yfgq+nFbWmNDpjoz0hKTVkMSQwhRR45EAmasKCTi8fyTl8H8SVH/NTtYXB1S5oNdSKDX53RSTz/UVi9EhH6XNWILKFdYxP1QvS09ib4burI0xExba71/jR5KEp+sOlpzK6P6nqjVjgodzJE11EZXm0++K2vZN2zzL6...
703,064
Combine the strings
Given an array s containing n strings, find the max length of the string obtained by combining the strings. Two strings can be combined only if the last character of the first string and the first character of the second string are the same. Examples: Input: n = 3 s[] = {"RBR", "BBR", "RRR"} Output: 9 Explanation: C...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "public int combine(int n, 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[]) {\n Scanner sc = new Scanner(S...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "combine(self, n,s)" ], "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 s = input().split()\n\n solObj = S...
eJylk00KwjAQhV3oPULWRRr7gwpuBk/QlWDEhXbhJnbRgiCKh9D7Oklb2yIz0loICbTvzczXl8f4tZ6M3LNZ4WF7lSeTFblcCqm0mWmTJInApY30hEwvWXrI0+P+XOTVV7E2d3x580RXGmgDAKJapHxByENbGaVY3S2gO6AsIrQAKwdR7vwgKiJ84hKCnaTxc63RXnPCC4G6PhgiLNCkbIGhQcmV39Fz+7CxLB4Gic8RAbYsJ8WqhisbUDi+E2oD17MD69KwhWFy/cnFYKMWCQejL40yW3UImF9BBaC+I//fkBYTsFDUv1RsRz/BMBao...
703,796
Sum of Products
Given an array arr[] of size n. Calculate the sum of Bitwise ANDsie: calculate sum of arr[i] & arr[j] for all the pairs in the given array arr[] where i < j. Examples: Input: n = 3 arr = {5, 10, 15} Output: 15 Explanation: The bitwise Ands of all pairs where i<j are (5&10) = 0, (5&15) = 5 and (10&15) = 10. Therefore...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "static long pairAndSum(int n, long arr[])" ], "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 Buf...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "pairAndSum(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 = list(map(int, input().strip().s...
eJyllLFOxDAMhhkQz2F1PqHYiZ2EJ0GiiAFuYCk33ElICMTCxgjvi0OT3t3gQuGvTrGii+t+/p3X08/3s5NvXb5pcPXU3Q+b3ba7gA77gfuBGNhBZEDnAIm7FXTrx836dru+u3nYbeufveR+eOmH7nkFxzmkHxAIAiRAAU9GAmccj5oh6LFyOGkWDRZmSFoA+cASE6QoHDxpQeNGhly3oG44qCtCXQnq6o0Xh+QxIWYxCkBXfqOAWuBbEFrALZAWxBakFuQWtITOKCo7xuijWFS41ETK0wXF6rLSxVwo+xQWAtbvzkWQiiAWgRQBF0Eo...
706,186
Find all possible palindromic partitions of a String
Given a String S, Find all possible Palindromic partitions of the given String. Examples: Input: S = "geeks" Output: g e e k s g ee k s Explanation: All possible palindromic partitions are printed. Input: S = "madam" Output: m a d a m m ada m madam Constraints: 1 <= |S| <= 20
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "static ArrayList<ArrayList<String>> allPalindromicPerms(String S)" ], "initial_code": "import 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": [ "allPalindromicPerms(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\n ob = Solution()\n allPart = o...
eJy1VMFKxDAQ9SD4A968DD0vQq9+iWBFpjGFQklKyBZBFD9C/9eXpNlkwemuoLt0902TeTPzMpOPy6+bq4v4ub8GeHhtRjPvfXNHTdsZbnbU6JdZK6+fn+zer0tMnXnvTPO2o2MHx0ordoKbIyZFGg+TA0W0dWUF54QTjxSGe6V6ObkeERR+Q5rRqgw4JhgppACTXvQk8E+oYMEzwRl4WVHwkOiMtUZgM2TxNfAEWgF2b1R+ovBS6aFQuU5nPXsrn5clDxKP/3RCsLmygnPCiUcMowctB9E04EmU2JhQ8JDpZp43CWdkPRdSwv5iBec1...
700,129
Power of Four
Given a number N, check ifNis power of 4or not. Examples: Input: N = 64 Output: 1 Explanation: 4 **3 = 64 Input: N = 75 Output: 0 Explanation : 75 is not a power of 4. Example 2:
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1618334504, "func_sign": [ "int isPowerOfFour(long n)" ], "initial_code": "import java.util.*;\nclass Check_Power_Of_4\n{\n\tpublic static void main(String args[])\n\t{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint t = sc.nextInt();\n\t\twhile(t>0)\...
{ "class_name": "Solution", "created_at_timestamp": 1618334504, "func_sign": [ "isPowerofFour(self, n)" ], "initial_code": "if __name__ == '__main__':\n test = int(input())\n for i in range(test):\n num = int(input())\n if Solution().isPowerofFour(num):\n print(1)\n e...
eJxrYJkaycIABhFBQEZ0tVJmXkFpiZKVgpJhTJ6hko6CUmpFQWpySWpKfH5pCUKqLiZPqVZHAVW9CYnqDc1I1GBkSqoOQwMjkl1lAAQk6zGxMDUn2XFGxiamZuYWlqQGg6GJuYmFsZmJBQ6NBrgiyMjSxNLM3MiS9GA0MSHZewhnkhl1QDuhUUiOXjIcTLGLyU86ZGQ3QwNsbibH4yQ7Gp6QCOiLnaIHAKX2Vh0=
700,563
Counting elements in two arrays
Given two unsorted arrays arr1[] and arr2[]. They may contain duplicates. For each element in arr1[] count elements less than or equal to it in array arr2[]. Examples: Input: m = 6, n = 6 arr1[] = {1,2,3,4,7,9} arr2[] = {0,1,2,1,1,4} Output: 4 5 5 6 6 6 Explanation: Number ofelements less than or equal to 1, 2, 3, 4...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1731067339, "func_sign": [ "public static ArrayList<Integer> countEleLessThanOrEqual(int a[], int b[])" ], "initial_code": "import java.io.*;\nimport java.util.*;\n\nclass Main {\n public static void main(String args[]) throws IOException {\n B...
{ "class_name": "Solution", "created_at_timestamp": 1731067339, "func_sign": [ "countEleLessThanOrEqual(self, a, b)" ], "initial_code": "if __name__ == '__main__':\n test_cases = int(input())\n for cases in range(test_cases):\n a = list(map(int, input().strip().split()))\n b = list(map...
eJzFVctOwzAQ5MCJr1jlXKHYjvPolyARxAF64BJ6aCUkhMRHwP8yYychbbPpC9R1NNo2tnf2mc/r7/nNVZA7B+X+PXlplutVMpfE1Y1J01QswREygifkhIJQEioCN6d146kSLMERMoIn5ISCUBKqsDn1PGfwU0opJBcvmTixYuomlZ3FPw1pgRQogRDogAyogEggTc6kTMbiI1/SJVuSDVyTmSSLt+XiabV4fnxdr1q3DQw7EPAgUoBQRWOB3sQzShT/Jh8zGYTU4p4YpxhHkKHQUSsjq27C62MgWNheiqugbtrnEBe3nDGRHZJGkYIi...
700,312
Third largest element
Given an array, arr of positive integers. Find the third largest element in it. Return -1 if the third largest element is not found. Examples: Input: arr[] = [2, 4, 1, 3, 5] Output: 3 Explanation: The third largest element in the array [2, 4, 1, 3, 5] is 3. Input: arr[] = [10, 2] Output: -1 Explanation: There are les...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1617046675, "func_sign": [ "int thirdLargest(int arr[])" ], "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 BufferedR...
{ "class_name": "Solution", "created_at_timestamp": 1617046675, "func_sign": [ "thirdLargest(self,arr)" ], "initial_code": "# Your code goes here\nif __name__ == '__main__':\n t = int(input())\n for i in range(t):\n arr = list(map(int, input().strip().split()))\n print(Solution().third...
eJy1VUtOwzAQZYHENUZZF5TxP5wEiSAW0AWbwKKVkBASh4C7sONqzJu4VSrsNF0Q189W4vm857H7cf71c3Gmz823TG7fmqfhZbtprqmx/cCeEnVkKRIbYkFivG7xUIdHMckHI8tcP3RqMWLuzYqa9evL+mGzfrx/3m6yf3hSYxn6oXlf0SS46QfrKGjcJBk4MuLeU4yYyBvWBEit93lkrATcr/0TjSUaGAkwwFQ8YFEp1SzI4TBNq7hgHMR61I48BREaorF8ZJXcEjtiX5Nw58GWKEEiM7IiJ91LD9Kj9IQEcw4V56nAlQubvy+BKm3M...
701,197
String Permutations
Given a string S. The task is to find all permutations (need not be different) of a given string. Examples: Input: S = AAA Output: AAA AAA AAA AAA AAA AAA Explanation: There are total 6 permutations, as given in the output. Input: S = ABSG Output: ABGS ABSG AGBS AGSB ASBG ASGB BAGS BASG BGAS BGSA BSAG BSGA GABS GASB...
geeksforgeeks
Hard
{ "class_name": "Solution", "created_at_timestamp": 1615327179, "func_sign": [ "public ArrayList<String> permutation(String S)" ], "initial_code": "//Initial Template for Java\n\n/*package whatever //do not write package name here */\n\nimport java.io.*;\nimport java.util.*;\nclass Main {\n\tpublic static...
{ "class_name": "Solution", "created_at_timestamp": 1615327179, "func_sign": [ "permutation(self,s)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == \"__main__\":\n T = int(input())\n while(T > 0):\n s = input()\n ob = Solution()\n ans = ob.permutation(s)\n...
eJx0vb3OhTGvpkUxB/Lpq6ehpXvin7yHgMSWKGAX0+yZYo+EhECcBC1HwEGycl9XhTSdZSd5VrIc27Ed5//6D//j//3//L//3f/0v//zP/3bf/mv//7P/+Ef//zv/+Xfvn/5t3/+x3/881//t//yr//Lv//r//o//+f/+u8Sv3/8y7/9nz/q//Ef//H/63KqZ+/ff7unDf4B8HcB7oq5fwvwt5L+Lpgde+3Ya++IuX8D8DeS/i6YO478a8s4d+31+6Zt/kbS34L5Ia6AX/9RxKwj/74g6dJr2nlNO69p5zXtvKad17Tzmm17bdtrb4u5...
701,196
Maximum occured integer
Given n integer ranges, the task is to return the maximum occurring integer in the given ranges. If more than one such integer exists, return the smallest one. The ranges are in two arrays l[] and r[]. l[i] consists of the starting point of the range and r[i] consists of the corresponding endpoint of the range & a maxx...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "public static int maxOccured(int n, int l[], int r[], int maxx)" ], "initial_code": "import java.io.*;\nimport java.lang.*;\nimport java.util.*;\n\nclass Main {\n\n public static void main(String[] args) throws IOException ...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "maxOccured(self,n, l, r, maxx)" ], "initial_code": "# Initial Template for Python 3\n\nimport math\n\nA = [0] * 1000000\n\n\ndef main():\n T = int(input())\n\n while T > 0:\n global A\n A = [0] * 1000000\n\...
eJy1VMtOwzAQ5IDEb4xyrpCfsc2XIBHEAXrgEji0EhIC8RHwjdz4BmaXSBSo2zQtsVZOYmdmd3bil+O3j5Mjvc7feXPx2Nz298tFc4bGdr01DDgOzxE4IkcrCyjISGg55F2A7/pmhmb+cD+/Xsxvru6WiwEodv0zF59m+ImuOAaO4RmBERmtEdbIBYZnBEZktNFUOax8tJYla7ZOOEgBwTFIBllZSEIOUpCBBEgROW5gqZDwExJQiwLrut5RkQxrYUMVqwaVBMpR0FYgjOJZYjM3QSdmXemNmEHwHGwrYjgm5okoeBG2wHm4tDMwWxg1...
703,299
Sum Triangle for given array
Given an array, write a program to construct a triangle where the last row contains elements of the given array, every element of the second last row contains the sum of the below two elements with modulo 10 **9+7, and so on. Examples: Input: arr[] = [4, 7, 3, 6, 7] Output: [81, 40, 41, 21, 19, 22, 11, 10, 9, 13, 4, 7...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "public ArrayList<Integer> getTriangle(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[]) thro...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "getTriangle(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 ...
eJztnEuOI1lyRTXQQhw5bjTe/9Nb6A0IUAsaSDXoSakHVUADghq9CGkFmmmVuueaMzIrKkgGI5izSiTdnU4n/T1718yufTz+/o//839//Af/+6f/1cE//+eXP//4l59/+vKH40v+0497H+/+/6cfv/zu+PLDX//yw7/99MO//+t//PzT5XdGKSmPY+Wc0rrsWuo9tVe7ksrs5e1dTrnOcXPX01jrzrb02tq7trmMWR7YjlrHuzc1j/XYJvfVPrCZuzz0qns8/Mp7fej1GLz+JoT91++OXyJUWDqe+LoK4l5aWUsXlVFya98e5JrTLG8e...
703,840
Rearrange the array
Given an array arr[] containing integers, your task is to print the array in the order – smallest number, largest number, 2nd smallest number, 2nd largest number, 3rd smallest number, 3rd largest number and so on. Examples: Input: arr[] = [1, 9, 2, 8, 3, 7, 4, 6, 5] Output: [1, 9, 2, 8, 3, 7, 4, 6, 5] Explanation: S...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1617814354, "func_sign": [ "public void rearrangeArray(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 cod...
{ "class_name": "Solution", "created_at_timestamp": 1617814354, "func_sign": [ "rearrangeArray(self, arr)" ], "initial_code": "def main():\n T = int(input())\n while T > 0:\n arr = [int(x) for x in input().strip().split()]\n ob = Solution()\n ob.rearrangeArray(arr)\n prin...
eJydVbtOxDAQpEB8xyj1CdmOn3wJEkEUcAVNuOJOQkIgPgJ+gI6/ZHcvuSfrC9hNpMzMrmeczfv55/fFmazrL3q4eWke+8Vq2VyhsV1vjSwUWbBwzQzN/Hkxv1/OH+6eVssRixHqBnDXv3V98zrDvmJQBIKCb9WSDq3CoWZ4663y1rh0AoPWwBsEg2iQDDI5YPiEmqS8ZGIRbhZ6GhTUSuwrSkZJKBEloHiUFoUs1JovYrRAimCzkJKwo+7HOpxT4WmZ4WhrKR4jFU0Hj4gMts7BetgIm8lCNW1y1zMkMjQLhbl6joVQieCBeHSNahdC...
703,156
Find the left over element
Given an array arr, the size is reduced by 1 element at each step. In the first step, the maximum element would be removed, while in the second step, the minimum element of the remaining array would be removed, in the third step again the maximum, and so on. Continue this till the array contains only one element. And f...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1616688609, "func_sign": [ "public static int leftElement(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 ...
{ "class_name": "Solution", "created_at_timestamp": 1616688609, "func_sign": [ "leftElement(self,arr) -> int" ], "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()\...
eJzFVcFuE0EM5cCFv3jac4XG9nrH0y9BahAHyIFL6CGVEIiq/Qf6v9gzCVIgDgQK3SjrTWw/e+Y9z949f7h/8axfrz75w9Xn6f3m+mY7XWKi1YZKv9D6BYZghmJBhaGBCohADBLQDFLQAqogA3l0WW2mC0zrj9frt9v1uzcfbrZ7aF5tbt375QI/FvQ0SMFcoAVLQS0wb8ArlajmXw8gjyAPIY8hDyKPIg+jFvkn6obveGHs1prnJpm7vdlvFZ29S2DPYbCAZ7CCF3AFG7j5TuT9LElDUV+9dhSVXqh1cEcjSMVMmL3DCvW4hoWwVFRC...
713,542
Largest Sum Cycle
Given a maze withNcells. Each cell may have multiple entry points but not more than one exit(i.e entry/exit points are unidirectional doors like valves). You are given an arrayEdge[]ofNintegers,where Edge[i] contains the cell number that can be reached from ofcelli in one step. Edge[i] is -1 if the ith cell doesn't hav...
geeksforgeeks
Hard
{ "class_name": "Solution", "created_at_timestamp": 1673867158, "func_sign": [ "public long largesSumCycle(int N, int Edge[])" ], "initial_code": "//Initial Template for Java\nimport java.util.*;\nimport java.lang.*;\nimport java.io.*;\nclass GFG{\n static class FastReader{ \n BufferedReader br;...
{ "class_name": "Solution", "created_at_timestamp": 1673867158, "func_sign": [ "largestSumCycle(self, N, Edge)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == \"__main__\":\n for _ in range(int(input())):\n N = int(input())\n Edge = [int(i) for i in input().split()]...
eJytk00OgjAQhV14kJeuxXSggHgSE2tcKAs31QUmJkbjIfR87jyHU/yJf0NAJSVhMe/rm8fMrn04tVvlMzjyx3CtZm6xLFQfiqyLrTOIEIKgVQcqXy3ySZFPx/Nlca0y1m2tU5sOnqUJqxGQP5rloSAPSNCT5pdvjmAQI0GKHjLZRdwAo9mUwImSSo4uw4iZlTIrQ0/AUFqBYVkp95jqbDOJEn7KhjhnghFYiZZgHB0ZUAQKPYAx9R2S9Pt9o97gZQLeTuNpsK6hSCx/qZM6e8Wl13WgmtygduGNzIq6mrfB/seC/LIhz0006ZwFfie+...
703,292
Count triplets with sum smaller than X
Given an array arr[] of distinct integers of size n and a value sum, the task is to find the count of triplets (i, j, k), having (i<j<k)with the sum of (arr[i] + arr[j] + arr[k])smaller than the given value sum. Examples: Input: n = 4, sum = 2, arr[] = {-2, 0, 1, 3} Output: 2 Explanation: Below are triplets with sum ...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1618484283, "func_sign": [ "long countTriplets(int n, int sum, long arr[])" ], "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": 1618484283, "func_sign": [ "countTriplets(self, n, sum, arr)" ], "initial_code": "t = int(input())\nfor _ in range(0, t):\n l = list(map(int, input().split()))\n n = l[0]\n k = l[1]\n a = list(map(int, input().split()))\n ob = Solution()\n...
eJyVlE1KxEAQhV3MQR69npL+744nEYy40CzcxFlkYGDw5xB6X6saFdQUpBO6CaTq63pVj37bfbzuLtpzfeKPm7N5nA/HxVzBuHEOsOPsQA7W7GGm02G6X6aHu6fj8hXE/1/G2Tzv8Tszw1nJtfAWwSJaJIusYYqCSeCNmEIDqIIKKCsIp5USQUkgIA8KoKgAopovaI/2duYWhO8GyvFBCtAYviqQCpdaK6yAPAoqkzQZflAw3EERQjwQ4okQj4R4JpR5FV5VuixHWG1KVZOZxCeUmNk6zH12/VMaxG9Z9PV4TT3pb1zzQE+sVsaa2al2...
712,195
Subarrays with K Distinct Integers
Given an integer array arr[]and an integer k, return the number of good subarrays of arr[]. A good array is an array where the number of distinct integers in that is exactly k. Examples: Input: arr[] = [1, 2, 1, 2, 3], k = 2 Output: 7 Explanation: Subarrays formed with exactly 2 different integers: arr[0..1], arr[0..2...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1666676624, "func_sign": [ "static int subarrayCount(int arr[], int k)" ], "initial_code": "// Initial Template for Java\n\nimport java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System....
{ "class_name": "Solution", "created_at_timestamp": 1666341607, "func_sign": [ "subarrayCount(self, arr, k)" ], "initial_code": "if __name__ == \"__main__\":\n t = int(input())\n for _ in range(t):\n arr = list(map(int, input().split()))\n k = int(input())\n\n obj = Solution()\n...
eJzVl7+OE0EMhyloeYdPW5/QemzPH56AjhaJIApIQROuyEknIRAPAe+LM9IhcWQiQja5Y1cjTbPjn7+f7d399vTHq2dP+vX6ZWzefJ4+bq5vttMLJllthIRiOJlCpSEzIkhCFDHEkYwUpCKNNJPimURSkpE8jpinK6b17fX6/Xb94d2nm+3d8Xm1+braTF+uuBd0jhiXWAsk54PktIySi6AXWBFooMzTAWX6G5T7gBYAVkfFYDqQtQuZ/gh6qhJSJhVSJTV0RgWNIxU11NGMFrSiDZsxwUJDRDTMsYwVrGINn0PisAqGJc7572MJHWjV...
703,718
1s Complement
Given an N bit binary number, find the 1's complement of the number.The ones'complementof a binary number isdefinedas the value obtained by inverting all the bits in the binary representation of the number (swapping 0s for 1s and vice versa). Examples: Input: N = 3 S = 101 Output: 010 Explanation: We get the output ...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "static String onesComplement(String S,int N)" ], "initial_code": "//Initial Template for Java\nimport java.io.*;\nimport java.util.*;\n\nclass GFG\n{\n public static void main(String args[])throws IOException\n {\n ...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "onesComplement(self,S,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 S = input()\n\n ob = Solution(...
eJxrYJn6iYMBDCJeAxnR1UqZeQWlJUpWCkqGMXmmMXmGIKCko6CUWlGQmlySmhKfX1oCVWEAAjF5dTF5SrU6CqhaLWLyDKAAh25DKMBhgKEBCMMgLhfAVeAyBegMXPbj1oLTw/jcamgI9CuIxB1aUDXYTMGlC5tlBoiwpSUgEG+0BHjDGRSOIIwznGFKcJliBAk/Q0h04PMnTBkOk2D5g6ikiiezILuIGCcZ4A8iotIiNDHiNIZOiWxQpjJ6+X1Qeh6afvIIJyB8mQyp/B9UQYqn0B/oJI+3diEuT0MyNd2jhL4xTAAQlwBip+gBAD+r...
704,621
Lucky alive person in a circle
Given N people standing in a circle where 1**stis having a sword, find the luckiest person in the circle, if, from 1**stsoldier who is having a sword each has to kill the next soldier and handover the sword to next soldier, in turn, the soldier will kill the adjacent soldier and handover the sword to next soldier such ...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "static int find(int N)" ], "initial_code": "//Initial Template for Java\n\n//Initial Template for Java\nimport java.io.*;\nimport java.util.*;\n//Position this line where user code will be pasted.\nclass GFG\n{\n public sta...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "find(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.find(N))\n ...
eJydlEEKwjAQRV30ICXrIpk0aRNPItjiwnbhJnbRgiCKh9D7mpZ04eIHplkFwpv5/8+Qd/btst1yjm24nB7i6odpFIdcUOPJiCIX/X3oL2PfnW/TuL6Zxr8aL55F/k8oCQgHAIOAsgYESYTUJVJlKmQEykJNtEVWSCrNbKOktkxES8c1Y8kprjAT1VVpY0rDMc0h0rJE/FwMzl9ZiQcgGdJdjeqEdVlKJPcgVE5YjyzXdwxtY2q0bcgzSX7jmOegE63D6q1fRfvZ/wB7kVxz
714,058
Is it Fibonacci
Geek just learnedabout Fibonacci numbers. Examples: Input: N = 6, K = 1 GeekNum[] = {4} Output: 4 Explanation: Terms are 4, 4, 4, 4, 4, 4 Input: N = 5, K = 3 GeekNum[] = {0, 1, 2} Output: 6 Explanation: Terms are 0, 1, 2, 3, 6. So the 5th term is 6 Constraints: 1 ≤ K < 30 1≤ N≤ 70 K≤ N 0 < GeekNum[ ] < 10...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1676465217, "func_sign": [ "static long solve(int N, int K, ArrayList<Long> GeekNum)" ], "initial_code": "//Initial Template for Java\n\nimport java.util.*;\nimport java.io.*;\n\npublic class Main\n{\n static FastIO f;\n \n public static void ma...
{ "class_name": "Solution", "created_at_timestamp": 1676465217, "func_sign": [ "solve(self, N, K, GeekNum)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == \"__main__\":\n for _ in range(int(input())):\n N, K = map(int, input().split())\n GeekNum = [int(i) for i in i...
eJytl82OHUUMRlmw5R1Ksw6o/Fe2eRIkglhAFmyGLBIJCYF4CHhfjm8mi4j0hYmYm0Q33V0u+/P5XD1/fP6Xf/HZ7eebL/ny7a8PPz2+fvvm4ev1IC8fZfHPfnixHl798vrVD29e/fj9z2/fPN3fLx9/f/n48NuL9eGi3LOq+2JZ9/U65R6rly5bvmKdlatWL+EiuegSW+JLYslZkktqSS9lIWt0qS31pbH0LM2ldZGCe9hW3Z7uKXmdj+0pZDU55OqzOlb7alutq2X1XtWrahVpnlWxylfZKl0lq/bKXlkrcyWVxEpfaSt1pay8klXM...
703,039
Count Pairs Odd Xor
Given an array arr[] of integers, find the number of pairs whose XOR is odd in the array. Examples: Input: arr[] = [1, 2, 3] Output: 2 Explanation: The XOR of the pairs is as follows: 1 ^ 2 = 3 (odd), 1 ^ 3 = 2 (even), 2 ^ 3 = 1 (odd), There are 2 pairs with odd XOR. Input: arr[] = [1, 2] Output: 1 Explanation: ...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "public long countOddXorPairs(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 = scanner....
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "countOddXorPairs(self, arr)" ], "initial_code": "def main():\n t = int(input().strip())\n for _ in range(t):\n arr = list(map(int, input().strip().split()))\n solution = Solution()\n print(solution.c...
eJxrYJlqwcIABhGGQEZ0tVJmXkFpiZKVgpJhTJ6hko6CUmpFQWpySWpKfH5pCVTKICavLiZPqVZHAU29AQiQqkmBVGuMFIxItgO3HiOcthgrGJOsx0TBTMGCZNcZK5gqmJMV2AqWIIBDqyF+rWRFlzFZuowUSI8zmDvJiG64VpKdCYxzUiPdELffcEWAEVl+AmqKiSFVHyS+DEnOlZAkQkBX7BQ9AMKkS4Y=
703,980
Area of Rectangle, Right Angled Triangle and Circle
Given the length of rectangle, width of rectangle, base of right angled triangle, perpendicular of right angled triangle and radius of circle respectively. Calculate the area of rectangle, right angled triangle and circle. Examples: Input: L = 32 , W = 32 , B = 54 H = 12 , R = 52 Output: 1024 324 8490 ...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "static int[] getAreas(int L , int W , int B , int H , 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 IOExcept...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "getAreas(self, L , W , B , H , 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 L, W, B, H, R = map(int, input().split(...
eJxrYJnaw8YABhGtQEZ0tVJmXkFpiZKVgpJhTJ6hAhQq6SgopVYUpCaXpKbE55eWwJQoGCgYx+TVxeQp1eoooOk1AAIFHCQu8wygQMEUxjA2NIGwcFkDMxZG4zMabCwhF6MaSIRxhF2IGgA4AxPhaWLClBgXglUS4URccUVCPBHre3xOJiPaqRxXqEFLUWqCGUKaz0lwIwk+J8tQmDBxhpsZWRgY4AwM1LxlQMDZxMaYAjicqVBIKRgYgI3AXgggrMHtFfzZkGQnKAyEGxBWEpPuzS2xmYbTEejqcCqLnaIHAFcYs+w=
703,077
Cutting Binary String
Given a string s containing 0's and 1's. You have to return the smallest positive integer C, such that the binary string can be cut into C pieces and each piece should be of the power of 5 with no leading zeros.Note:The string sis a binary string. And if no such cuts are possible, then return -1. Examples: Input: s = "...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "static int cuts(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": [ "cuts(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 solObj = Solution()\n print(solObj.cuts(s))\...
eJxrYJm6npUBDCJWABnR1UqZeQWlJUpWCkqGMXmGIGAAZCjpKCilVhSkJpekpsTnl5YglNQBJWt1FND0GRDSaYpbJxTi1KqL01a4ZjL0GoCcbGBAnmcNCPgWj5OBgORAMiAZkBMg5HvIwJA8K0GREBODFpN5pJtDXggRTrRUsxDZshhSLcMaSmhBT0agYTWWrHAEWm9ARnqLiSGYBSmNcjJCm9yyCBQRZGYf3P43g2qLnaIHAGCAonM=
701,228
Roof Top
You are given the heights of consecutive buildings. You can move from the roof of a building to the roof of the next adjacent building. You need to find the maximum number of consecutive steps you can put forward such that you gain an increase in altitude with each step. Examples: Input: arr[] = [1, 2, 2, 3, 2] Output...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "public int maxStep(int arr[])" ], "initial_code": "import java.io.*;\nimport java.lang.*;\nimport java.util.*;\n\nclass gfg {\n\n public static void main(String args[]) throws IOException {\n BufferedReader read = ne...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "maxStep(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 = Solution()\...
eJytlE1OxDAMhVnAPZ6yHiHbTfMzJ0EiiAV0wabMoiMhIdAcAg7CjuPhhBlGRYNE2iZ1WqXyV9t57u78/fPirIyrD324fjYP/WY7mDUMp54pG4TQECyhJTiCJwRCJDCRWcF0T5vubujubx+3w95X/V5Tb15WGAND6luMZiWAWzU06ukRIbBwCBoIWMAW7MBB462kSs4T/5lSSXYZLBqw1ZC5NlnJ5c8DMY+yhrJ6fGNHr8tW5Te0nkdqPPDqE81SUXnYCBtgPazDT+KVKK+XHmosxzohpXiseaN31sq7JQWR0ixJ5PBqXP4S8wmy2mSJ...
702,684
Cumulative frequency of count of each element in an unsorted array
Given an array arr[] of elements. The task is to calculate the cumulative frequency of each distinct element of the array. Examples: Input: arr[] = [1, 2, 2, 1, 3, 4] Output: [2, 4, 5, 6] Explanation: The elements are first counted for their frequencies, resulting in {1: 2, 2: 2, 3: 1, 4: 1}. These elements are then...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1617363466, "func_sign": [ "public int[] countFreq(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 publi...
{ "class_name": "Solution", "created_at_timestamp": 1617363466, "func_sign": [ "countFreq(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 ...
eJztlstOWzEQhlmw5hlGZw2V7RlfDk+C1KAu2iy6SVkECakC8RDwvnx2SnNa5NzaDSLnxFESfceemf8fO4+nz3Z20q6rCz58/jl8X9zcLodLGfxs4V29ZKyXTL6U6Zc8nMswv7uZf13Ov335cbt8fV6CqKTZ4mG2GO7P5a+pg1qUlMvopPd58ktnDZPSm5/gpEiWJFGMQIL4jYEaXIIvUlPtzSo73Z2FQm/aKK83Ya9eob3UdaaKUhroe4H2cu0m9rYG/6FcK5f8YaP23iuQWGemIOtb220thJ4xUg0LJXRDZLIKhwzGzOCRMTKMoYzA...
704,001
Check if the door is open or closed
Given N doors and N persons. The doors are numbered from 1 to N and persons are given id’s numbered from 1 to N. Each door can have only twostatuses i.e. open (1) or closed (0) . Initially all the doors have status closed. Find the final status of all the doors, when all the persons have changedthe status of the doors ...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "static int[] checkDoorStatus(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 BufferedRe...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "checkDoorStatus(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 ...
eJztXMtqU1EUdeA3OBPCHRdJQgPilwhGHGgGTmIHKQii+BH6Mf6dacyFtORc795nP89ZXTSkzV6PvXKTprehP5//fvnn2enj7YvjlXffhs/7u/vD8GYxrLb71XK4WQy7r3e7j4fdpw9f7g/jbYvlEf8uz9e2+x/b/fD9ZvFYYkOQuMDjr65/p/zd6UirpWOmCUzfOm/iNFXYe+15X1jsPWuKNkmf5jH4LCaz+HDFMcLptMljRIwtoyCnIqskr6ajOEu1/DMTTwzUSfo0j8Fn1THr2TIKciqySvJqOop6qrrK+uo2DnYutk72bj6Ofq4K...
700,279
Equilibrium index of an array
The equilibrium index of an array is an index such that the sum of elements at the left indexes is equal to the sum of elements at the right indexes. Given an array arr, your task is to find the index of the first Equilibrium point in the array. If there is no equilibrium point then return -1. Examples: Input: arr[] = ...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1618047048, "func_sign": [ "int findEquilibrium(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 s...
{ "class_name": "Solution", "created_at_timestamp": 1618047048, "func_sign": [ "findEquilibrium(self, arr)" ], "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 while t > 0:\n arr = list(...
eJy1U8FOwzAM5TDxHSanHWaUNE3b8CVIbOKw9bBL2aGTkBCIj4D/xY4jTTCyzRW0Ul5S1fZ7z8777HN+fZWe+xvaPLyY7bDbj+YOjFsOzloLmNa/3/JiFmD6512/HvvN49N+zKWRar8tB/O6gO+ELJx9CyltIWMABxE8tBnPnLWESS9gAPSknNg5yajW7cQ6iAKdQCvQCASBWsALVAJOIK2TaoeUn7dBToevhXz+RLrKMkGZBkA+odcPg2NPK4onU8ngGrAmc8ntBrChhmELHWBHbcOYHZigneJipHiuREfuIFWckIl74VN/soVYJ91s...
703,166
Race in Fooland
There is a multi-lane running track with lanes numbered from 1 to tracks(Tracks). There are some horizontal barriers placed across the lanes. Each barrier spans from lane start_i to lane end_i (both inclusive). The barriers may overlap, and athletes cannot run on lanes covered by a barrier. Examples: Input: tracks = 20...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1616689594, "func_sign": [ "public int emptyLanes(int tracks, List<int[]> barriers)" ], "initial_code": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int t...
{ "class_name": "Solution", "created_at_timestamp": 1616689594, "func_sign": [ "empty_lanes(self, tracks, barriers)" ], "initial_code": "def main():\n t = int(input())\n for _ in range(t):\n n = int(input())\n arr = list(map(int, input().split()))\n barriers = [(arr[i], arr[i + ...
eJztVbtuFEEQdEDkryhtbKPp6XnyJZYAEcAFJMbBWUJCliDjA/D/Ml19K7DY9enuQDjwJFOt2X539X59cf/9/Izn6tsAr79MH69vbrfTK0zy5loCzwDIRH4Jdg/TBabN55vN++3mw7tPt9ud5lCY7i6wZMtMyQm69I/UxznaDg1FKBIyCioazBhkhBYhCkmQDCmQCmmQjhgQh05EVMSEmBELYkVsiB0aoAIdJhWaoBlaoBXaoB1pxCtIEWl4TEgZqSBVpDbyGAmtJGAp5sUs8pzECMrrwWvu0Zq9lYJ4Ryx5T9KT8aDzaLigBBRBDaiC...
710,021
Matrix Operations
Given a binary matrixof dimensions M* N.One can perform the given operation inthe matrix. Examples: Input: matrix[][] = {{0,1}, {1,0}} Output: (1,1) Explanation: Input: matrix[][] = {{0, 1, 1, 1, 0}, {1, 0, 1, 0, 1}, {1, 1, 1, 0, 0}} Output: (2,0)
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1646060677, "func_sign": [ "static int [] endPoints(int [][]arr, int m, int n)" ], "initial_code": "//Initial Template for Java\n\n//Initial Template for Java\n\nimport java.io.*;\nimport java.util.*;\n\nclass GFG\n{\n public static void main(String a...
{ "class_name": "Solution", "created_at_timestamp": 1646060677, "func_sign": [ "endPoints(self, matrix, m, n)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n t = int(input())\n for _ in range(t):\n r, c = map(int, input().strip().split())\n matrix =...
eJztWcGO0zAQ5cB3ICsnkCLkabarhS9BoogD9MAl7KErIaFd8RHwd9z4EZomjj0zbyZp6S5L6Ubauq49M+/N8zhxvj398evZk93fm5/bxtuv1af2+mZTvQ4VrdplWK5aCjFQd3XN7opdMw69sR8Q+97+522zqkO1/nK9/rBZf3z/+WYz2HxOdYgvVu3dqq1u68C9XYTLzu5gIVkeTCaP4pftp+WqqQNZri5DMwQ72B0s6k6ysSwcLFfhqqAr0RNDBjHAGNEWUSTMfSBpBJUjYiYpG6SSmzTioPBpOzPKaAiCyMoogKgkpW4FqEcpQJUj...
703,921
Parity of unsigned integer
Given an integer N, find it's parity.Parity of a number refers to the number of 1bitsit contains.The number has “odd parity”, if it contains odd number of 1-bits and is “even parity” if it contains even number of 1-bits. Examples: Input: N = 13 Output: odd Explanation: (13) 10 = (1101) 2 The binary representation ...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "static String computeParity(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": 1615292571, "func_sign": [ "computeParity(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.com...
eJxrYJm6jYUBDCLWAxnR1UqZeQWlJUpWCkqGMXmGSjoKSqkVBanJJakp8fmlJVCp/JSUmLy6mDylWh0FVB1GJOswNDAyIVmTmampsSkOXallqXk47QIBcvQZGZOuC+RIM5K9ZgkCZDjRzNiC9HA0NjI3syA9yszIsMqQvJA3g0cbGVYC3QnzJJ60STDB4LIZr7sRVoMYRjC/gEVwBh+RJkINJMNDBiAfURIbRPiNGsGWZ0SE52Kn6AEAG5J9mg==
713,539
Minimum times A has to be repeated such that B is a substring of it
Given two strings A and B. Find minimum number of times A has to be repeated such that B is a Substring of it. If B can never be a substring then return -1. Examples: Input: A = "abcd" B = "cdabcdab" Output: 3 Explanation: Repeating A three times (abcdabcdabcd), B is a substring of it. B is not a substring of A when ...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1730887254, "func_sign": [ "static int minRepeats(String s1, String s2)" ], "initial_code": "import java.io.*;\nimport java.util.*;\n\nclass GFG {\n public static void main(String args[]) throws IOException {\n BufferedReader read = new Buffere...
{ "class_name": "Solution", "created_at_timestamp": 1730887254, "func_sign": [ "minRepeats(self, s1, s2)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n t = int(input())\n for _ in range(t):\n A = input()\n B = input()\n\n ob = Solution()\n ...
eJzNVctOhDAUdWHiB7hzRViPJmBm45eYeI3hcTND0tx2SlHAmPgR+r+2FJIZoDOAE2Mp7U2Bc8rpue3n5ffN1UVTHq918PTuZyQK5T94fgjEOG1yJTPa7MdjEVC+5VIBEW+CRGOsPB9LgYnC9IUXqoW9B7oNgPyPlXdItkXGONAblywFKih7RZkjELZRN+LANaAjwHpEosBIdb1tHSDh2PeRrnFyhHb4L2Vl7u4Cqkugqi6b6gBau3Qx9JFuYl1Nceu6Hp29EEyraNpozl+LncxV24ndTL1oulpBo25qFjpNYtcUl1imh9w4KIjt/Oxj...
704,409
K-Palindrome
Given a string strof length n,findif the string is K-Palindrome or not. A k-palindrome string transforms into a palindrome on removing at most k characters from it. Examples: Input: str = "abcdecba" n = 8, k = 1 Output: 1 Explanation: By removing 'd' or 'e' we can make it a palindrome. Input: str = "abcdefcba" n = ...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "public int kPalindrome(String str, 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 ...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "kPalindrome(self, s, n, k)" ], "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 n = int(arr[0])\n k =...
eJytVN0OwTAYdcF7fOm1yMrceBKJinRd2fy0MyMSIR6C99XWwoKSD7voerHzs/Od9lg/q0bNPf2J2Qx2JFXZuiA9IJQpGkCbKR4JEXGzxqQJRG4zKQoZj/S6KL8MmDowRfZNeIJ3HTyW40mSTrFwCh0Hv4rLMRbfdfg00kmW6Cjlc72RWI4QQqZyLqTguci5fXkoqIeiHQANqjHM5guls2W+KrBmwPJg5cEsHIvqXFFYWFj2BdsUY9IlxctZY3Ufx4Se05tgfWq/yFUSfvH3vu5+O0TL53P9NXkZ+Y1OGjp3aF8696XzoRD3/v5ajYrP...
700,443
Minimum four sum subsequence
You are given an array arr[] of positive integers. Your task is to find the minimum sum of a subsequence such that the subsequence includes at least one element from every group of four consecutive elements in the array. Examples: Input: arr[] = [1, 2, 3, 4, 5, 6, 7, 8] Output: 6 Explanation: 6 is sum of output subs...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "public static int minSum(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 pub...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "minSum(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 res...
eJytVcFOwzAM5YDEbzz1PKE4iZOYE5+BxBAH2IFL2WGTkBCIj4D/xS4g2CSPthDJc7s29svzs/ty/HZ+cjSsC9GLy8furl9vN90ZOlr2FBADUkAOYJSAGtACJICC/g/SF0jfoBS6BbrVw3p1s1ndXt9vN59BWlv2z8u+e1pgLzSDGiIjRkRBzEgViZAjEiM3JAHrbQY3ZHHCUyQnvu6DKMQKQkFEcyJkD1+wpZvHXzgZopNBBKQW1ZJalgaWiiIFVRhNMkSU4yBRiW6aJTYvB9Um3kG+YEYNJ5Zs8Erq4KvxpKsoS+ZZGTOfXcbdPArz...
703,318
Tracks
You are given an array arr[] representing the heights of pillars on a track. The track is considered valid if it satisfies the following conditions: Examples: Input: arr[] = [2, 1, 2] Output: true Explanation: The track is valid because it has a constant height difference of 1, the middle pillar is 1, and both sides ...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "public boolean ValidTrack(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 pu...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "ValidTrack(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 ...
eJy1VFsKwjAQ9EM8x5LvIk3f9SSCERGtIEgt2oIgiofQE/jnKd02abGlLbjGlJIlJJOd2dncho/XaFCM6ROD2Zlt4yRL2QQYFzE3IYQAfPDABQd/D+MA17gpYmYAi05JtEqj9WKfperYZrk7RiK+4oaLAQ08aPloSGYxICyGnAJEU4FaVrtIN+SEbbAQ08IZyXeipIesC0TqJmEqIPBoCUnGjqTmlIxVoJZdOuGyyjXSecUpxBv14ToqUiVGSahulGLyy7T8um1o6v1uYg7aVJKtq9BqDSzERwv3q/mFGW0pcLcf9Xa5Gbb1+Q9ECAdR...
703,194
Sum of XOR of all pairs
Given an array of N integers, find the sum of xor of all pairs of numbers in the array arr. In other words, select all possible pairs of i and j from 0 to N-1 (i<j) and determine sum of all (arri xor arrj). Examples: Input: arr[ ] = {7, 3, 5} Output: 12 Explanation: All possible pairs and there Xor Value: ( 3 ^ 5 = ...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "public long sumXOR(int arr[], int n)" ], "initial_code": "//Initial Template for Java\n\n//Initial Template for Java\n\n//Initial Template for Java\n\n/*package whatever //do not write package name here */\n\nimport java.io.*;...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "sumXOR(self, arr, n)" ], "initial_code": "# Initial Template for Python 3\n\nfor _ in range(0, int(input())):\n n = int(input())\n arr = list(map(int, input().strip().split()))\n ob = Solution()\n res = ob.sumXOR(a...
eJylVNtKxDAQ9UH/Y8jzIpPMJYlfIlgR0YK+1H3owoIofoT+r0nqgiKTrnhKS0nnnMycmfTt9OPh7KTh8ra8XD27x2m7m90FOD9MYZg8eKxwG3DjfjvezeP9zdNuPgTVbyXydZjcywZ+0qXRl8vgo0EtO1OIGqE+k0FWERJDwGO9ISAQAiMIgiJEhISQsRZliBJSspPKFX1LlAx6WQ/AYFUTrG2bjY0JXq0+BDbYWtiBWECYQtGpAK4ArYBUYbZXOZuJlYJaC5YmleQosSVEHqPVbFlSBNGYIHv0ZV6CJ/DsxepS0hJs63WsMp06zNwf...
704,863
Number of paths in a matrix with k coins
Given a n x nmatrix such thateach of itscells contains somecoins. Count the number of ways to collect exactly k coins while moving fromtop left corner of the matrixto thebottom right. From a cell (i, j), you can only move to (i+1, j) or (i, j+1). Examples: Input: k = 12, n = 3 arr[] = [[1, 2, 3], [4, 6, 5], ...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "long numberOfPath(int n, int k, int [][]arr)" ], "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 ...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "numberOfPath(self, n, k, arr)" ], "initial_code": "# Initial Template for Python 3\n\nif __name__ == '__main__':\n ob = Solution()\n t = int(input())\n for _ in range(t):\n k = int(input())\n n = int(inp...
eJzdlk1u1EAQhVlkyx0+eR2h7uqu/uEkSDjKIsyCjcliIkVCIA4Bl2LHjXixkkhBWOBhMkzi8sKudlVXP7/XXV9Ovv14+WK+3nzXw9uPw/vp8mo7vGaI49T7OMUwTk4jUukYmUQhBr00uQo+u0wfyLnkPzLnOA2nDJvry83FdvPu/MPV9m7RqWvws8Y/nfIQjPt7KXQhzuagwGyL0WEh2scpKQG/2GKeslSFJsg3iUwIZCFRhEgTMjc/TQkFSiJmohPL6irN50qdlbYeDg2U3+Cxm62evmqg/y2KxEqUcKSagCnGMLEvY44VrGIN66RA...
703,297
Largest Element in Array
Given an array, arr. The task is to find the largest element in it. Examples: Input: arr = [1, 8, 7, 56, 90] Output: 90 Explanation: The largest element of the given array is 90. Input: arr = [5, 5, 5, 5] Output: 5 Explanation: The largest element of the given array is 5. Input: arr = [10] Output: 10 Explanatio...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1728560398, "func_sign": [ "public static int largest(int[] arr)" ], "initial_code": "import java.io.*;\nimport java.util.*;\n\nclass IntArray {\n public static int[] input(BufferedReader br, int n) throws IOException {\n String[] s = br.readLi...
{ "class_name": "Solution", "created_at_timestamp": 1728560398, "func_sign": [ "largest(self, arr : 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().split()] # array input\n ...
eJytVLtOxDAQpKDgM0YpqA7kdezY5iOokTCigBQ0vityEhIC8RHwvzgOAZKL7Rjw5VZWsrMvzezr8fvZyVE4V6f+cv1UPbjdvqsuUJF1xMKxrtqgah937V3X3t9u993oMnyHdZdb11r34j2fN5gGYTDhYPQmXgvZwGjVSBGNnYalUyrMftEsB57pwL4G9EUo3ddFRBxUkyAJakiRBhnOOMUHtg6fLkIycIaZDU80bxyS7bcvN1iFYDWCNQiWIVhCsDzVeFGgHKUIHH6UkPDDhEagSYJLi/65MTMI/69ZPzAWAKkJL3inE3ASSui6EQpf...
703,185
k largest elements
Given an array arr of n positive integers and an integer k, Your task is to return k largest elements in decreasing order. Examples: Input: arr[] = {12, 5, 787, 1, 23}, n = 5, k = 2 Output: 787 23 Explanation: 1st largest element in the array is 787 and second largest is 23. Input: arr[] = {1, 23, 12, 9, 30, 2, 50}, ...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1730219806, "func_sign": [ "static List<Integer> kLargest(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.\npubl...
{ "class_name": "Solution", "created_at_timestamp": 1730219806, "func_sign": [ "kLargest(self,arr, k)" ], "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 k = int(input().s...
eJy9VU1KxTAQduHCC7hzMXT9kCSdJo0nEay40C7c1LfoA0EUD6H39WvTQLCZtj7FlGFKmG/+Z/J++nlxdjKe63P83LwUj93+0BdXVOim02o85McTWB2YC8w2XVXsqGif9+193z7cPR36iN8Cfmu64nVH38ySoZKYKrLkCBjSanBGNASJGpIWCAbSkJY0wx+tNAgyqgQxqAJZkAPVIL8UlJ+E3ASqBFMlZT9ZdSKSVTjmkEIEMYoYiWk6Fj02k9AIkBOTKVa+EOVPCi6WOEpXgekJSaFJHCEku2JIgAomK0XsiWtiR2yJ0StMjPAMsSZG...
704,965
Subtraction and two numbers
Given two integers A and B.Find out the number of steps required to repeatedly subtract the smaller of the two from the larger until one of them becomes 0. Examples: Input: A=5,B=13 Output: 6 Explanation: The steps are as follows: (5,13)->(5,8)->(5,3)->(2,3)->(2,1)->(1,1)->(1,0) Thus, 6 steps are required. Input: A=...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "int repeatedSubtraction(int A,int B)" ], "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 BufferedR...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "repeatedSubtraction(self, A, B)" ], "initial_code": "# Initial Template for Python 3\n\nimport math\n\nif __name__ == '__main__':\n t = int(input())\n for _ in range(t):\n A, B = map(int, input().strip().split(\" ...
eJydlLFOxDAMhhngPaLMJ1THdhzfkyBRxAAdWMoNPQkJge4hQGLjVTlRmoNT3YTz5MH6Yv/+nd35++fF2XdcfeyT62f/0G+2g187D20PAYmjJHWaJDJhAL9yvnvadHdDd3/7uB2mYhQQCtr2r23vX1buCNRM4UxCLjEYOgaK+8mCWqjAi6QAJJQwkricRoN1qDVgjDFJoxAcNIJCkAJZrOJklji5oqwvT9lpTWjFrnmvr4WZnsfciBS2xAsNJXSH0UzjJLJkGf2LNQYODVOqltcSd9G94zSzvD8XUhg3Wi44euO3s/4Py7dPRe0SAwUp...
701,240
Sort by Absolute Difference
You are given a number k and array arr. Your task is to rearrange the elements of array arr according to the absolute difference with k, i.e., an element having minimum difference comes first, and so on.Note: If two or more elements are at equal distances arrange them in the same sequence as in the given array. Example...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "static void sortABS(int k, List<Integer> arr)" ], "initial_code": "// Initial Template for Java\n\nimport java.io.*;\nimport java.lang.*;\nimport java.util.*;\n\n//Position this line where user code will be pasted.\nclass GFG ...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "sortABS(self,k,arr)" ], "initial_code": "# Position this line where user code will be pasted.\ndef main():\n import sys\n input = sys.stdin.read\n data = input().split('\\n')\n\n t = int(data[0].strip())\n index...
eJzFVUtOwzAQZcGCY4yyrlDifzgJEkUsIAs2oYtWqoRAHAJOxY4TMeN40tDGsaNUwqpe02bm+c3P/rj8+rm68Ov2Gx/uXovndrPbFjdQVOu2KmnxN9S0PDqP1qNZt8UKima/aR63zdPDy27LDAm3d/R8W8HRnvgBARIU6DjzwWKURAfdwBFEedggqiVBMOnO6Yu7J/RPJtCjhj4XEK8E2+rgqQKPDKwi7JHIh2ZRIAgkgSIgvWAILIHzqgmqZPbmUo0Ks9q/82kDoXtzJNHMgqiZNi5paG8HXh11IBU6LkX+aT0fXRdeFx8zmeEOJQcZ...
702,949
Value equal to index value
Given an arrayarr. Your task is to find the elements whose value is equal to that of its index value ( Consider 1-based indexing ). Examples: Input: arr[] = [15, 2, 45, 4 , 7] Output: 2 , 4 Explanation: Here, arr[2] = 2 exists here. and arr[4] = 4 exists here. Input: arr[] = [1] Output: 1 Explanation: Here arr[1] ...
geeksforgeeks
Easy
{ "class_name": "Solution", "created_at_timestamp": 1618055830, "func_sign": [ "public List<Integer> valueEqualToIndex(List<Integer> nums)" ], "initial_code": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n ...
{ "class_name": "Solution", "created_at_timestamp": 1618055830, "func_sign": [ "valueEqualToIndex(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 = Sol...
eJy9VU1PwzAM5YDE33jqeUKz07QLP4AjZySCOLAduGQ7dBISAvEj4LdyQzhOV/GRrt1gpKqcpvHze47dPh+/vp8c6bh8k8nVQ3EXVuumOENBPtBUhw/FBMXifrW4bRbzm+W6abdcLBucL9dh7sOTbHqc4Jt/rych59If6Se207EfNROlgWAgMwuWSQnrw0zXLGrM5OoHN4l965ceTFZRKZESvg+V4jrE0DE5FrQJDbKfX4IYZGQxsmuvLalMIBr+q2xqudksN+64CX6Vi19GXlSBapDkxoGnYPFhsAGXYKvnAOfE1dVyV3IPU907XE5k...
702,762
Equivalent Sub-Arrays
Given an array arr[] of n integers. Count the total number of sub-array having total distinct elements same as that of total distinct elements of the original array. Examples: Input: N=5 arr[] = {2, 1, 3, 2, 3} Output: 5 Explanation: Total distinct elements in array is 3 Total sub-arrays that satisfy the condition ...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "static int countDistinctSubarray(int arr[], int n)" ], "initial_code": "//Initial Template for Java\n//Initial Template for Java\nimport java.io.*;\nimport java.util.*;\n\n//Position this line where user code will be pasted.\n...
{ "class_name": "Solution", "created_at_timestamp": 1615292571, "func_sign": [ "countDistinctSubarray(self,arr, 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(...
eJy1VMtOwzAQ5AD/sfK5Qvb6kbhfgkQQB8iBS+ghlZAQqB8BP8qNG2M7CSpi00DVOInWG+9kd3bs3fn758VZvq4+YFw/q4dus+3VmpRpOqObzlOgimqKZDSMQHCoFan2adPe9e397eO2HyMQ8tp06mVFP3AYDzFZKm9HE6oA5SQkn5BMxuGMZTOey5gYAl4U8FgnPI/qOJdms22HLAMytMgzwquloiXklCkT7kjOEwM5pBnsqk4GPFEnJzwBXMQ0LQswhWFd+orFUfw3SzTh/mO+Ro/M7g0BxXsBJoyddnNCEYJtSYGFMKlaiKUowEn/...
704,623
Handshakes
We have Npersons sitting on a round table. Any person can do a handshake with any other person. Examples: Input: N = 2 Output: 1 Explanation: {1,2} handshake is possible. Input: N = 4 Output: 2 Explanation: {{1, 2}, {3, 4}} are the two handshakes possible. {{1, 3}, {2, 4}} is another set of handshakes possible. ...
geeksforgeeks
Medium
{ "class_name": "Solution", "created_at_timestamp": 1720418841, "func_sign": [ "static int count(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 BufferedReader re...
{ "class_name": "Solution", "created_at_timestamp": 1720418841, "func_sign": [ "count(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.count(N))\n ...
eJzNVc1OxCAY9ODBx2g4bwx8UEp9EhMxHrQHL7iHbrKJ0Rhv3vV95XdDW7626ppsD5QAHeabGejb+dfHxZl/rt9t5+aZPJrtridXFam1AW2ENlIbpQ2j2pBNRbr9trvvu4e7p10fVzJtXv1i29a+ZcK/RBgjL5sqA7ZzDMIaZrGZwoE5RJw2wnIaBpQsQnNPw1HlS3Qjt1a2Qom6BAaBG0gU6UCjsQwpLYHYzQAvEGQjhCh+WIc6klJg+wA4k8BjIphsWhl8UY2SiGROK+cECBQ/l+ngAlBFGWax8sFxtTMcNuYk4OZipAKmoiQhHFmQ...