{"payload":{"feedbackUrl":"https://github.com/orgs/community/discussions/53140","repo":{"id":750429969,"defaultBranch":"main","name":"GeeksforGeeks-POTD-solutions","ownerLogin":"dhr7va","currentUserCanPush":false,"isFork":false,"isEmpty":false,"createdAt":"2024-01-30T16:23:45.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/138505718?v=4","public":true,"private":false,"isOrgOwned":false},"refInfo":{"name":"","listCacheKey":"v0:1706631947.0","currentOid":""},"activityList":{"items":[{"before":"2b905922c15343a85d23ac30dea3833e1b76efc3","after":"d179604748029a477fd156165c2fc0e313d5a6b0","ref":"refs/heads/main","pushedAt":"2024-07-07T05:16:03.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"dhr7va","name":"Dhruva Kumar","path":"/dhr7va","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/138505718?s=80&v=4"},"commit":{"message":"Create 07-07-2024.py\n\nAncestors in Binary Tree\r\n\r\nGiven a Binary Tree and an integer target. Find all the ancestors of the given target.\r\n\r\nNote:\r\n\r\n The ancestor of node x is node y, which is at the upper level of node x, and x is directly connected with node y. Consider multiple levels of ancestors to solve this problem.\r\n In case there are no ancestors available, return an empty list.\r\n\r\nExamples:\r\n\r\nInput:\r\n 1\r\n / \\\r\n 2 3\r\n / \\ / \\\r\n 4 5 6 8\r\n /\r\n 7\r\ntarget = 7\r\nOutput: [4 2 1]\r\nExplanation: The given target is 7, if we go above the level of node 7, then we find 4, 2 and 1. Hence the ancestors of node 7 are 4 2 and 1\r\n\r\nInput:\r\n 1\r\n / \\\r\n 2 3\r\ntarget = 1\r\nOutput: [ ]\r\nExplanation: Since 1 is the root node, there would be no ancestors. Hence we return an empty list.\r\n\r\nExpected Time Complexity: O(n).\r\nExpected Auxiliary Space: O(height of tree)\r\n\r\nConstraints:\r\n1 ≤ no. of nodes ≤ 10^3\r\n1 ≤ data of node ≤ 10^4","shortMessageHtmlLink":"Create 07-07-2024.py"}},{"before":"20a524c77e1c0a4fdc8da4c9e37b6556b578ab87","after":"2b905922c15343a85d23ac30dea3833e1b76efc3","ref":"refs/heads/main","pushedAt":"2024-07-06T10:04:40.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"dhr7va","name":"Dhruva Kumar","path":"/dhr7va","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/138505718?s=80&v=4"},"commit":{"message":"Create 06-07-2024.py\n\nPopulate Inorder Successor for all nodes\r\n\r\nGiven a Binary Tree, complete the function to populate the next pointer for all nodes. The next pointer for every node should point to the Inorder successor of the node.\r\nYou do not have to return or print anything. Just make changes in the root node given to you.\r\n\r\nNote: The node having no in-order successor will be pointed to -1. You don't have to add -1 explicitly, the driver code will take care of this.\r\n\r\nExamples :\r\n\r\nInput:\r\n 10\r\n / \\\r\n 8 12\r\n /\r\n 3\r\nOutput: 3->8 8->10 10->12 12->-1\r\nExplanation: The inorder of the above tree is : 3 8 10 12. So the next pointer of node 3 is pointing to 8 , next pointer of 8 is pointing to 10 and so on.And next pointer of 12 is pointing to -1 as there is no inorder successor of 12.\r\n\r\nInput:\r\n 1\r\n / \r\n 2 \r\n /\r\n 3 \r\nOutput: 3->2 2->1 1->-1\r\nExplanation: The inorder of the above tree is: 3 2 1. So the next pointer of node 3 is pointing to 2 , next pointer of 2 is pointing to 1. And next pointer of 1 is pointing to -1 as there is no inorder successor of 1.\r\n\r\nExpected Time Complexity: O(n)\r\nExpected Auxiliary Space: O(1)\r\n\r\nConstraints:\r\n1<= no. of nodes <=10^5\r\n1<= data of the node <=10^5","shortMessageHtmlLink":"Create 06-07-2024.py"}},{"before":"d1550d97894ab73f8654b9408ae9107cc1163f30","after":"20a524c77e1c0a4fdc8da4c9e37b6556b578ab87","ref":"refs/heads/main","pushedAt":"2024-07-04T18:55:33.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"dhr7va","name":"Dhruva Kumar","path":"/dhr7va","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/138505718?s=80&v=4"},"commit":{"message":"Create 05-07-2024.py\n\nVertical Width of a Binary Tree","shortMessageHtmlLink":"Create 05-07-2024.py"}},{"before":"363b4462d2850948a1765514c152920bb260fb55","after":"d1550d97894ab73f8654b9408ae9107cc1163f30","ref":"refs/heads/main","pushedAt":"2024-07-04T09:03:06.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"dhr7va","name":"Dhruva Kumar","path":"/dhr7va","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/138505718?s=80&v=4"},"commit":{"message":"Create 04-07-2024.py\n\nDuplicate Subtrees\r\n\r\nGiven a binary tree, your task is to find all duplicate subtrees from the given binary tree.\r\n\r\n Duplicate Subtree : Two trees are duplicates if they have the same structure with the same node values.\r\n\r\nNote: Return the root of each tree in the form of a list array & the driver code will print the tree in pre-order tree traversal in lexicographically increasing order.","shortMessageHtmlLink":"Create 04-07-2024.py"}},{"before":"84c698d2f596314e6cb9c6448824561dcbc94c15","after":"363b4462d2850948a1765514c152920bb260fb55","ref":"refs/heads/main","pushedAt":"2024-07-03T06:50:59.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"dhr7va","name":"Dhruva Kumar","path":"/dhr7va","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/138505718?s=80&v=4"},"commit":{"message":"Create 03-07-2024.py\n\nRemove all occurences of duplicates in a linked list","shortMessageHtmlLink":"Create 03-07-2024.py"}},{"before":"8f3d5b46dab9b69a5cbde0ea103164e0a6633aaf","after":"84c698d2f596314e6cb9c6448824561dcbc94c15","ref":"refs/heads/main","pushedAt":"2024-07-02T13:47:18.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"dhr7va","name":"Dhruva Kumar","path":"/dhr7va","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/138505718?s=80&v=4"},"commit":{"message":"Create 02-07-2024.py\n\nLinked list of strings forms a palindrome","shortMessageHtmlLink":"Create 02-07-2024.py"}},{"before":"d2bdcccd9c187b630c42236f05934f8ddd248cc3","after":"8f3d5b46dab9b69a5cbde0ea103164e0a6633aaf","ref":"refs/heads/main","pushedAt":"2024-07-01T05:39:12.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"dhr7va","name":"Dhruva Kumar","path":"/dhr7va","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/138505718?s=80&v=4"},"commit":{"message":"Create 01-07-2024.py\n\nMake Binary Tree From Linked List\r\n\r\nGiven a Linked List Representation of Complete Binary Tree. The task is to construct the Binary tree and print the level order traversal of the Binary tree. \r\nNote: The complete binary tree is represented as a linked list in a way where if the root node is stored at position i, its left, and right children are stored at position 2*i+1, and 2*i+2 respectively. H is the height of the tree and this space is used implicitly for the recursion stack.\r\n\r\nExamples:\r\n\r\nInput: n = 5, k = 1->2->3->4->5\r\nOutput: 1 2 3 4 5\r\nExplanation: The tree would look like\r\n 1\r\n / \\\r\n 2 3\r\n / \\\r\n4 5\r\nNow, the level order traversal of\r\nthe above tree is 1 2 3 4 5.\r\n\r\nInput: n = 5, k = 5->4->3->2->1\r\nOutput: 5 4 3 2 1\r\nExplanation: The tree would look like\r\n 5\r\n / \\\r\n 4 3\r\n / \\\r\n2 1\r\nNow, the level order traversal of\r\nthe above tree is 5 4 3 2 1.\r\n\r\nExpected Time Complexity: O(n).\r\nExpected Auxiliary Space: O(n).\r\nConstraints:\r\n1 <= n <= 10^5\r\n1 <= ki <= 10^5","shortMessageHtmlLink":"Create 01-07-2024.py"}},{"before":"12ff652d6390fff42f4cebc2094f8569cfbd8655","after":"d2bdcccd9c187b630c42236f05934f8ddd248cc3","ref":"refs/heads/main","pushedAt":"2024-06-30T13:57:51.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"dhr7va","name":"Dhruva Kumar","path":"/dhr7va","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/138505718?s=80&v=4"},"commit":{"message":"Create 30-06-2024.py\n\nDelete node in Doubly Linked List","shortMessageHtmlLink":"Create 30-06-2024.py"}},{"before":"e45504b8810387eb78bd8375e75e472d678bd1fd","after":"12ff652d6390fff42f4cebc2094f8569cfbd8655","ref":"refs/heads/main","pushedAt":"2024-06-29T11:18:27.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"dhr7va","name":"Dhruva Kumar","path":"/dhr7va","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/138505718?s=80&v=4"},"commit":{"message":"Create 29-06-2024.py\n\nIdentical Linked Lists\r\n\r\nGiven the two singly Linked Lists respectively. The task is to check whether two linked lists are identical or not. \r\nTwo Linked Lists are identical when they have the same data and with the same arrangement too. If both Linked Lists are identical then return true otherwise return false.","shortMessageHtmlLink":"Create 29-06-2024.py"}},{"before":"7b4e06778b03a379a2f76b23349d79a0f85c4e72","after":"e45504b8810387eb78bd8375e75e472d678bd1fd","ref":"refs/heads/main","pushedAt":"2024-06-28T02:59:44.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"dhr7va","name":"Dhruva Kumar","path":"/dhr7va","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/138505718?s=80&v=4"},"commit":{"message":"Create 28-06-2024.py\n\nThe Palindrome Pattern\r\n\r\nGiven a two-dimensional integer array arr of dimensions n x n, consisting solely of zeros and ones, identify the row or column (using 0-based indexing) where all elements form a palindrome. If multiple palindromes are identified, prioritize the palindromes found in rows over those in columns. Within rows or columns, the palindrome with the smaller index takes precedence. The result should be represented by the index followed by either 'R' or 'C', indicating whether the palindrome was located in a row or column. The output should be space-separated. If no palindrome is found, return the string -1.\r\n\r\nExamples:\r\n\r\nInput: \r\narr[][] = [[1, 0, 0], \r\n [0, 1, 0],\r\n [1, 1, 0]]\r\nOutput: 1 R\r\nExplanation: In the first test case, 0-1-0 is a palindrome \r\noccuring in a row having index 1.\r\n\r\nInput: \r\narr[][] = [[1, 0],\r\n [1, 0]]\r\nOutput: 0 C\r\nExplanation: 1-1 occurs before 0-0 in the 0th column. And there is no palindrome in the two rows.\r\n\r\nExpected Time Complexity: O(n^2)\r\nExpected Auxiliary Space: O(1)\r\n\r\nConstraints:\r\n1<= arr.size <= 50\r\n0 <= arr[i][j] <= 1","shortMessageHtmlLink":"Create 28-06-2024.py"}},{"before":"3ed96c117997f9174477a4afdec8d28f5f6b30ad","after":"7b4e06778b03a379a2f76b23349d79a0f85c4e72","ref":"refs/heads/main","pushedAt":"2024-06-27T16:12:15.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"dhr7va","name":"Dhruva Kumar","path":"/dhr7va","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/138505718?s=80&v=4"},"commit":{"message":"Create 27-06-2024.py\n\nToeplitz matrix\r\n\r\nA 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.\r\n\r\nExamples:\r\n\r\nInput:\r\nmat = [[6, 7, 8],\r\n [4, 6, 7],\r\n [1, 4, 6]]\r\nOutput: true\r\nExplanation: The test case represents a 3x3 matrix\r\n 6 7 8 \r\n 4 6 7 \r\n 1 4 6\r\nOutput will be true, as values in all downward diagonals from left to right contain the same elements.\r\n\r\nInput: \r\nmat = [[1,2,3],\r\n [4,5,6]]\r\nOutput: false\r\nExplanation: Matrix of order 2x3 will be 1 2 3 4 5 6 Output: false as values in all diagonals are not the same.\r\n\r\nConstraints:\r\n1<=mat.size,mat[0].size<=40\r\n0<=mat[i][j]<=100\r\n\r\nExpected time complexity: O(n*m)\r\nExpected space complexity: O(1)","shortMessageHtmlLink":"Create 27-06-2024.py"}},{"before":"fac8bcfd3138bb57833f3fa48a38eab46f1f1950","after":"3ed96c117997f9174477a4afdec8d28f5f6b30ad","ref":"refs/heads/main","pushedAt":"2024-06-25T18:46:01.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"dhr7va","name":"Dhruva Kumar","path":"/dhr7va","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/138505718?s=80&v=4"},"commit":{"message":"Create 26-06-2024.py\n\nCoverage of all Zeros in a Binary Matrix\r\n\r\nGiven a binary matrix having n rows and m columns, your task is to find the sum of coverage of all zeros in the matrix where coverage for a particular 0 is defined as a total number of ones around a zero in left, right, up, and bottom directions.\r\n \r\n\r\nExamples:\r\n\r\nInput: \r\nmatrix = [[0, 1, 0],\r\n [0, 1, 1], \r\n [0, 0, 0]]\r\nOutput: 6\r\n\r\nInput: \r\nmatrix = [[0, 1]]\r\nOutput: 1\r\n\r\nExpected Time Complexity: O(n * m)\r\nExpected Space Complexity: O(1)\r\n \r\n\r\nConstraints:\r\n1 <= mat.size, mat[0].size <= 100","shortMessageHtmlLink":"Create 26-06-2024.py"}},{"before":"f624ca5bd649617df2674cf46ed9351c4b976126","after":"fac8bcfd3138bb57833f3fa48a38eab46f1f1950","ref":"refs/heads/main","pushedAt":"2024-06-25T03:56:37.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"dhr7va","name":"Dhruva Kumar","path":"/dhr7va","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/138505718?s=80&v=4"},"commit":{"message":"Create 25-06-2024.py\n\nLeft Rotate Matrix K times\r\n\r\nYou are given an integer k and matrix mat. Return a matrix where it is rotated Left k times.\r\n\r\nExamples:\r\n\r\nInput: k=1, mat=[[1,2,3],[4,5,6],[7,8,9]]\r\nOutput:\r\n1 2 3\r\n4 5 6\r\n7 8 9\r\nExplanation: Rotate the matrix by one\r\n1 2 3 2 3 1\r\n4 5 6 => 5 6 4\r\n7 8 9 8 9 7\r\n\r\nInput: k=2, mat=[[1,2,3],[4,5,6],[7,8,9]]\r\nOutput:\r\n3 1 2\r\n6 4 5\r\n9 7 8\r\nExplanation: After rotating the matrix looks like\r\n1 2 3 2 3 1 3 1 2\r\n4 5 6 => 5 6 4 => 6 4 5\r\n7 8 9 8 9 7 9 7 8\r\n\r\nExpected Time Complexity: O(n*m)\r\nExpected Auxillary Space: O(n*m)\r\n\r\nConstraints:\r\n1<= mat.size, mat[0].size, mat[i][j] <=1000","shortMessageHtmlLink":"Create 25-06-2024.py"}},{"before":"43b25ccdfb2b589e42733961f7cac2088ceefca5","after":"f624ca5bd649617df2674cf46ed9351c4b976126","ref":"refs/heads/main","pushedAt":"2024-06-24T15:58:43.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"dhr7va","name":"Dhruva Kumar","path":"/dhr7va","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/138505718?s=80&v=4"},"commit":{"message":"Create 24-06-2024.py\n\nSummed Matrix\r\n\r\nA matrix is constructed of size n*n and given an integer ‘q’. The value at every cell of the matrix is given as, M(i,j) = i+j, where ‘M(i,j)' is the value of a cell, ‘i’ is the row number, and ‘j’ is the column number. Return the number of cells having value ‘q’.\r\n\r\nNote: Assume, the array is in 1-based indexing.\r\n\r\nExamples:\r\n\r\nInput: n = 4, q = 7\r\nOutput: 2\r\nExplanation: Matrix becomes\r\n2 3 4 5 \r\n\r\n\r\n4 5 6 7\r\n5 6 7 8\r\nThe count of 7 is 2.\r\n\r\nInput: n = 5, q = 4\r\nOutput: 3\r\nExplanation: Matrix becomes\r\n2 3 4 5 6 \r\n3 4 5 6 7 \r\n4 5 6 7 8 \r\n5 6 7 8 9 \r\n6 7 8 9 10 \r\nThe count of 4 is 3.\r\n\r\nExpected Time Complexity: O(1)\r\nExpected Auxiliary Space: O(1)\r\n\r\nConstraints:\r\n1 ≤ n,q ≤ 10^18","shortMessageHtmlLink":"Create 24-06-2024.py"}},{"before":"7f183ddef7cbf16cf0f77848a834a45551c78ad3","after":"43b25ccdfb2b589e42733961f7cac2088ceefca5","ref":"refs/heads/main","pushedAt":"2024-06-23T16:25:12.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"dhr7va","name":"Dhruva Kumar","path":"/dhr7va","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/138505718?s=80&v=4"},"commit":{"message":"Create 23-06-2024.py\n\nPrint Bracket Number\r\n\r\nGiven a string str, the task is to find the bracket numbers, i.e., for each bracket in str, return i if the bracket is the ith opening or closing bracket to appear in the string. \r\n\r\n Examples:\r\n\r\nInput: str = \"(aa(bdc))p(dee)\"\r\nOutput: 1 2 2 1 3 3\r\nExplanation: The highlighted brackets in\r\nthe given string (aa(bdc))p(dee) are\r\nassigned the numbers as: 1 2 2 1 3 3.\r\n\r\nInput: str = \"(((()(\"\r\nOutput: 1 2 3 4 4 5\r\nExplanation: The highlighted brackets in\r\nthe given string (((()( are assigned\r\nthe numbers as: 1 2 3 4 4 5\r\n\r\nExpected Time Complexity: O(|str|)\r\nExpected Auxiliary Space: O(|str|)\r\n\r\nConstraints:\r\n1 <= |str| <= 10^5\r\nstr contains lowercase English alphabets, and '(', ')' characters\r\nAt any index, the number of opening brackets is greater than or equal to closing brackets","shortMessageHtmlLink":"Create 23-06-2024.py"}},{"before":"f3bca184514a7f26547705fbb78b566e245497cb","after":"7f183ddef7cbf16cf0f77848a834a45551c78ad3","ref":"refs/heads/main","pushedAt":"2024-06-22T03:26:21.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"dhr7va","name":"Dhruva Kumar","path":"/dhr7va","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/138505718?s=80&v=4"},"commit":{"message":"Create 22-06-2024.py\n\nExtract the Number from the String\r\n\r\nGiven a sentence containing several words and numbers. Find the largest number among them which does not contain 9. If no such number exists, return -1.\r\n\r\nExamples :\r\n\r\nInput: sentence=\"This is alpha 5057 and 97\"\r\nOutput: 5057\r\nExplanation: 5057 is the only number that does\r\nnot have a 9.\r\n\r\nInput: sentence=\"Another input 9007\"\r\nOutput: -1\r\nExplanation: Since there is no number that\r\ndoes not contain a 9,output is -1.\r\n\r\nExpected Time Complexity: O(n)\r\nExpected Auxillary Space: O(n)\r\n\r\nConstraints:\r\n1<=n<=10^6\r\n1<=answer<=10^18","shortMessageHtmlLink":"Create 22-06-2024.py"}},{"before":"62f6d2d34a45178a1fbfeed1dc18155a0340fe54","after":"f3bca184514a7f26547705fbb78b566e245497cb","ref":"refs/heads/main","pushedAt":"2024-06-21T02:45:35.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"dhr7va","name":"Dhruva Kumar","path":"/dhr7va","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/138505718?s=80&v=4"},"commit":{"message":"Create 21-06-2024.py\n\nCompare two fractions\r\n\r\nYou are given a string str containing two fractions a/b and c/d, compare them and return the greater. If they are equal, then return \"equal\".\r\n\r\nNote: The string str contains \"a/b, c/d\"(fractions are separated by comma(,) & space( )). \r\n\r\nExamples\r\n\r\nInput: str = \"5/6, 11/45\"\r\nOutput: 5/6\r\nExplanation: 5/6=0.8333 and 11/45=0.2444, So 5/6 is greater fraction.\r\n\r\nInput: str = \"8/1, 8/1\"\r\nOutput: equal\r\nExplanation: We can see that both the fractions are same, so we'll return a string \"equal\".\r\n\r\nInput: str = \"10/17, 9/10\"\r\nOutput: 9/10\r\nExplanation: 10/17 = 0.588 & 9/10 = 0.9, so the greater fraction is \"9/10\".\r\n\r\nExpected Time Complexity: O(len|str|)\r\nExpected Auxiliary Space: O(1)\r\n\r\nConstraints:\r\n0<=a,c<=10^3\r\n1<=b,d<=10^3","shortMessageHtmlLink":"Create 21-06-2024.py"}},{"before":"e767cbb0735217280aae9cc1e334adbbdb86ce8d","after":"62f6d2d34a45178a1fbfeed1dc18155a0340fe54","ref":"refs/heads/main","pushedAt":"2024-06-21T02:41:11.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"dhr7va","name":"Dhruva Kumar","path":"/dhr7va","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/138505718?s=80&v=4"},"commit":{"message":"Create 20-06-2024.py","shortMessageHtmlLink":"Create 20-06-2024.py"}},{"before":"115dfcbf41a08a6186dd3ae220926057f8589c71","after":"e767cbb0735217280aae9cc1e334adbbdb86ce8d","ref":"refs/heads/main","pushedAt":"2024-06-19T03:09:57.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"dhr7va","name":"Dhruva Kumar","path":"/dhr7va","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/138505718?s=80&v=4"},"commit":{"message":"Create 19-06-2024.py\n\nFind maximum volume of a cuboid\r\n\r\nYou are given a perimeter & the area. Your task is to return the maximum volume that can be made in the form of a cuboid from the given perimeter and surface area.\r\nNote: Round off to 2 decimal places and for the given parameters, it is guaranteed that an answer always exists.\r\n\r\nExamples\r\n\r\nInput: perimeter = 22, area = 15\r\nOutput: 3.02\r\nExplanation: The maximum attainable volume of the cuboid is 3.02\r\n\r\nInput: perimeter = 20, area = 5\r\nOutput: 0.33\r\nExplanation: The maximum attainable volume of the cuboid is 0.33\r\n\r\nExpected Time Complexity: O(1)\r\nExpected Auxiliary Space: O(1)\r\n\r\nConstraints :\r\n1 ≤ perimeter ≤ 10^9\r\n1 ≤ area ≤ 10^9","shortMessageHtmlLink":"Create 19-06-2024.py"}},{"before":"e1784632149eacacbd6b6d75842e653052138278","after":"115dfcbf41a08a6186dd3ae220926057f8589c71","ref":"refs/heads/main","pushedAt":"2024-06-18T14:52:29.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"dhr7va","name":"Dhruva Kumar","path":"/dhr7va","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/138505718?s=80&v=4"},"commit":{"message":"Create 18-06-2024.py\n\nNumber of Rectangles in a Circle\r\n\r\nGiven a circular sheet of radius, r. Find the total number of rectangles with integral length and width that can be cut from the sheet that can fit on the circle, one at a time.\r\n\r\nExamples :\r\n\r\nInput: r=1\r\nOutput: 1\r\nExplanation: Only 1 rectangle of dimensions 1x1.\r\n\r\nInput: r=2\r\nOutput: 8\r\nExplanation: The 8 possible rectangles are \r\n(1x1)(1x2)(1x3)(2x1)(2x2)(2x3)(3x1)(3x2).\r\n\r\nExpected Time Complexity: O(r^2)\r\nExpected Auxillary Space: O(1)\r\n\r\n\r\nConstraints:\r\n1<=r<=1000","shortMessageHtmlLink":"Create 18-06-2024.py"}},{"before":"a15710ece2d9b2f77841e6351e3c51273983188e","after":"e1784632149eacacbd6b6d75842e653052138278","ref":"refs/heads/main","pushedAt":"2024-06-17T14:18:00.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"dhr7va","name":"Dhruva Kumar","path":"/dhr7va","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/138505718?s=80&v=4"},"commit":{"message":"Create 17-07-2024.py\n\nCheck If two Line segments Intersect\r\n\r\nGiven the coordinates of the endpoints(p1,q1, and p2,q2) of the two line segments. Check if they intersect or not. If the Line segments intersect return true otherwise return false.\r\n\r\nNote: Please check the intersection lies within the line segments.\r\n\r\nExamples\r\n\r\nInput: p1=(1,1), q1=(10,1), p2=(1,2), q2=(10,2)\r\nOutput: false\r\nExplanation:The two line segments formed by p1-q1 and p2-q2 do not intersect.\r\n\r\nInput: p1=(10,0), q1=(0,10), p2=(0,0), q2=(10,10)\r\nOutput: true\r\nExplanation: The two line segments formed by p1-q1 and p2-q2 intersect.\r\n\r\nInput: p1=(5,-2), q1=(13,2), p2=(2,-3), q2=(3,0)\r\nOutput: false\r\nExplanation: The two line segments formed by p1-q1 and p2-q2 are intersecting beyond endpoints, so it is not considerable.\r\n\r\nExpected Time Complexity: O(1)\r\nExpected Auxillary Space: O(1)\r\n\r\nConstraints:\r\n-10^6<=X,Y(for all points)<=10^6","shortMessageHtmlLink":"Create 17-07-2024.py"}},{"before":"b434bab2c01941b6e75c1ba73216e5bb2c4c9556","after":"a15710ece2d9b2f77841e6351e3c51273983188e","ref":"refs/heads/main","pushedAt":"2024-06-16T15:33:09.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"dhr7va","name":"Dhruva Kumar","path":"/dhr7va","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/138505718?s=80&v=4"},"commit":{"message":"Create 16-06-2024.py\n\nPrime Pair with Target Sum\r\n\r\nGiven a number n, find out if n can be expressed as a+b, where both a and b are prime numbers. If such a pair exists, return the values of a and b, otherwise return [-1,-1] as an array of size 2.\r\nNote: If [a, b] is one solution with a <= b, and [c, d] is another solution with c <= d, and a < c then [a, b] is considered as our answer.\r\n\r\nExamples\r\n\r\nInput: n = 10\r\nOutput: 3 7\r\nExplanation: There are two possiblities 3, 7 & 5, 5 are both prime & their sum is 10, but we'll pick 3, 7 as 3 < 5.\r\n\r\nInput: n = 3\r\nOutput: -1 -1\r\nExplanation: There are no solutions to the number 3.\r\n\r\nExpected Time Complexity: O(n*loglog(n))\r\nExpected Auxiliary Space: O(n)\r\n\r\nConstraints:\r\n2 <= n <= 10^6","shortMessageHtmlLink":"Create 16-06-2024.py"}},{"before":"77123b9802eb9b3c822b620907598f362347c63f","after":"b434bab2c01941b6e75c1ba73216e5bb2c4c9556","ref":"refs/heads/main","pushedAt":"2024-06-15T02:54:25.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"dhr7va","name":"Dhruva Kumar","path":"/dhr7va","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/138505718?s=80&v=4"},"commit":{"message":"Create 15-06-2024.py\n\nMobile numeric keypad","shortMessageHtmlLink":"Create 15-06-2024.py"}},{"before":"e24f4817a3d5abe8d619b506cf1263360b6fba1f","after":"77123b9802eb9b3c822b620907598f362347c63f","ref":"refs/heads/main","pushedAt":"2024-06-14T02:57:52.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"dhr7va","name":"Dhruva Kumar","path":"/dhr7va","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/138505718?s=80&v=4"},"commit":{"message":"Create 14-06-2024.py\n\nArmstrong Numbers\r\nYou are given a 3-digit number n, Find whether it is an Armstrong number or not.\r\n\r\n An Armstrong number of three digits is a number such that the sum of the cubes of its digits is equal to the number itself. 371 is an Armstrong number since 33 + 73 + 13 = 371.\r\n\r\nNote: Return \"Yes\" if it is an Armstrong number else return \"No\".\r\n\r\nExamples\r\n\r\nInput: n = 153\r\nOutput: Yes\r\nExplanation: 153 is an Armstrong number since 13 + 53 + 33 = 153. Hence answer is \"Yes\".\r\n\r\nInput: n = 372\r\nOutput: No\r\nExplanation: 372 is not an Armstrong number since 3^3 + 7^3 + 2^3 = 378. Hence answer is \"No\".\r\n\r\nExpected Time Complexity: O(1)\r\nExpected Auxiliary Space: O(1)\r\n\r\nConstraints:\r\n100 ≤ n <1000","shortMessageHtmlLink":"Create 14-06-2024.py"}},{"before":"2932d1c94800034c56557dddf7dfd3a9258f7218","after":"e24f4817a3d5abe8d619b506cf1263360b6fba1f","ref":"refs/heads/main","pushedAt":"2024-06-13T16:54:06.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"dhr7va","name":"Dhruva Kumar","path":"/dhr7va","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/138505718?s=80&v=4"},"commit":{"message":"Create 13-06-2024.py\n\nPadovan Sequence\r\n\r\nGiven a number n, find the nth number in the Padovan Sequence.\r\n\r\n A Padovan Sequence is a sequence which is represented by the following recurrence relation\r\n P(n) = P(n-2) + P(n-3)\r\n P(0) = P(1) = P(2) = 1\r\n\r\nNote: Since the output may be too large, compute the answer modulo 10^9+7.\r\n\r\nExamples :\r\n\r\nInput: n = 3\r\nOutput: 2\r\nExplanation: We already know, P1 + P0 = P3 and P1 = 1 and P0 = 1\r\n\r\nInput: n = 4\r\nOutput: 2\r\nExplanation: We already know, P4 = P2 + P1 and P2 = 1 and P1 = 1\r\n\r\nExpected Time Complexity: O(n)\r\nExpected Auxiliary Space: O(1)\r\n\r\nConstraints:\r\n1 <= n <= 10^6","shortMessageHtmlLink":"Create 13-06-2024.py"}},{"before":"ba3e845d95b145f59fbcffa594ba32127ad5d090","after":"2932d1c94800034c56557dddf7dfd3a9258f7218","ref":"refs/heads/main","pushedAt":"2024-06-12T03:41:41.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"dhr7va","name":"Dhruva Kumar","path":"/dhr7va","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/138505718?s=80&v=4"},"commit":{"message":"Create 12-06-2024.py\n\nCount numbers containing 4\r\n\r\nYou are given a number n, Return the count of total numbers from 1 to n containing 4 as a digit.\r\n\r\nExamples:\r\n\r\nInput: n = 9\r\nOutput: 1\r\nExplanation: 4 is the only number between 1 to 9 which contains 4 as a digit.\r\n\r\nInput: n = 14\r\nOutput: 2\r\nExplanation: 4 and 14 are the only number between 1 to 14 that contains 4 as a digit.\r\n\r\nExpected Time Complexity: O(nlogn)\r\nExpected Auxiliary Space: O(1)\r\n\r\nConstraints:\r\n1 <= n <= 10^5","shortMessageHtmlLink":"Create 12-06-2024.py"}},{"before":"f241c218b24d1304bd41778ae1e096957572e910","after":"ba3e845d95b145f59fbcffa594ba32127ad5d090","ref":"refs/heads/main","pushedAt":"2024-06-11T03:39:52.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"dhr7va","name":"Dhruva Kumar","path":"/dhr7va","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/138505718?s=80&v=4"},"commit":{"message":"Create 11-06-2024.py","shortMessageHtmlLink":"Create 11-06-2024.py"}},{"before":"d8dfebd1df876f355b99c7aae3a58fa19705194d","after":"f241c218b24d1304bd41778ae1e096957572e910","ref":"refs/heads/main","pushedAt":"2024-06-10T02:33:59.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"dhr7va","name":"Dhruva Kumar","path":"/dhr7va","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/138505718?s=80&v=4"},"commit":{"message":"Create 10-06-2024.py\n\nNuts and Bolts Problem\r\n\r\nGiven a set of n nuts & bolts. There is a one-on-one mapping between nuts and bolts. You have to Match nuts and bolts efficiently. Comparison of a nut to another nut or a bolt to another bolt is not allowed. It means the nut can only be compared with the bolt and the bolt can only be compared with the nut to see which one is bigger/smaller.\r\nThe elements should follow the following order: { !,#,$,%,&,*,?,@,^ }\r\n\r\nNote: Make all the required changes directly in the given arrays, output will be handled by the driver code.\r\n\r\nExamples\r\n\r\nInput: n = 5, nuts[] = {@, %, $, #, ^}, bolts[] = {%, @, #, $ ^}\r\nOutput: \r\n# $ % @ ^\r\n# $ % @ ^\r\nExplanation: As per the order # should come first after that $ then % then @ and ^. \r\n\r\nInput: n = 9, nuts[] = {^, &, %, @, #, *, $, ?, !}, bolts[] = {?, #, @, %, &, *, $ ,^, !}\r\nOutput: \r\n! # $ % & * ? @ ^\r\n! # $ % & * ? @ ^\r\nExplanation: We'll have to match first ! then # , $, %, &, *, @, ^, ? as per the required ordering.\r\n\r\nExpected Time Complexity: O(n(logn))\r\nExpected Auxiliary Space: O(log(n))\r\n\r\nConstraints:\r\n1 <= n <= 9\r\nThe arrays 'nuts' and 'bolts' can only consist of the following elements: {'@', '#', '$', '%', '^', '&', '?', '*', '!'}.\r\nAll the elements of arrays 'nuts' and 'bolts' should be unique.","shortMessageHtmlLink":"Create 10-06-2024.py"}},{"before":"a458661bc0b86698015de8585a8259867e705b25","after":"d8dfebd1df876f355b99c7aae3a58fa19705194d","ref":"refs/heads/main","pushedAt":"2024-06-09T08:41:49.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"dhr7va","name":"Dhruva Kumar","path":"/dhr7va","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/138505718?s=80&v=4"},"commit":{"message":"Create 09-06-2024.py\n\nConvert array into Zig-Zag fashion\r\n\r\nGiven an array arr of distinct elements of size n, the task is to rearrange the elements of the array in a zig-zag fashion so that the converted array should be in the below form: \r\n\r\n arr[0] < arr[1] > arr[2] < arr[3] > arr[4] < . . . . arr[n-2] < arr[n-1] > arr[n]. \r\n\r\nNote:\r\n\r\n Modify the given arr[] only, If your transformation is correct, the output will be 1 else the output will be 0. \r\n The output will be zero if the given array cannot be modified.\r\n\r\nExamples\r\n\r\nInput: n = 7, arr[] = {4, 3, 7, 8, 6, 2, 1}\r\nOutput: 1\r\nExplanation: After modification the array will look like 3 < 7 > 4 < 8 > 2 < 6 > 1, the checker in the driver code will produce 1.\r\n\r\nInput: n = 7, arr[] = {4, 4, 4, 7, 7, 7, 7}\r\nOutput: 0\r\nExplanation: If we try to modify the array will look like 4 < 7 > 4 < 7 > 4 < 7 but here one more 7 is left so it can not be conveted zig zag so we leave the array as it is & the output will be 0.\r\n\r\nExpected Time Complexity: O(n)\r\nExpected Auxiliary Space: O(1)\r\n\r\nConstraints:\r\n1 <= n <= 10^6\r\n0 <= arri <= 10^9","shortMessageHtmlLink":"Create 09-06-2024.py"}},{"before":"33fbc81505173fecc1e12c0a105993053ccfb3bb","after":"a458661bc0b86698015de8585a8259867e705b25","ref":"refs/heads/main","pushedAt":"2024-06-08T13:42:35.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"dhr7va","name":"Dhruva Kumar","path":"/dhr7va","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/138505718?s=80&v=4"},"commit":{"message":"Create 08-06-2024.py\n\nIndex of an Extra Element\r\n\r\nYou have given two sorted arrays arr1[] & arr2[] of distinct elements. The first array has one element extra added in between. Return the index of the extra element.\r\n\r\nNote: 0-based indexing is followed.\r\n\r\nExamples\r\n\r\nInput: n = 7, arr1[] = {2,4,6,8,9,10,12}, arr2[] = {2,4,6,8,10,12}\r\nOutput: 4\r\nExplanation: In the first array, 9 is extra added and it's index is 4.\r\n\r\nInput: n = 6, arr1[] = {3,5,7,8,11,13}, arr2[] = {3,5,7,11,13}\r\nOutput: 3\r\nExplanation: In the first array, 8 is extra and it's index is 3.\r\n\r\nExpected Time Complexity: O(log n).\r\nExpected Auxiliary Space: O(1).\r\n\r\nConstraints:\r\n1<=n<=10^5\r\n1<=arr1[i],arr2[i]<=10^6","shortMessageHtmlLink":"Create 08-06-2024.py"}}],"hasNextPage":true,"hasPreviousPage":false,"activityType":"all","actor":null,"timePeriod":"all","sort":"DESC","perPage":30,"cursor":"djE6ks8AAAAEeLRPngA","startCursor":null,"endCursor":null}},"title":"Activity · dhr7va/GeeksforGeeks-POTD-solutions"}