{"id":18362053,"url":"https://github.com/tanishqjasoria/python_practice","last_synced_at":"2025-04-10T04:37:15.639Z","repository":{"id":94083238,"uuid":"86144344","full_name":"tanishqjasoria/python_practice","owner":"tanishqjasoria","description":"Python : Practice problems for beginners","archived":false,"fork":false,"pushed_at":"2017-08-02T02:08:07.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-15T19:17:29.129Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tanishqjasoria.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-03-25T08:48:55.000Z","updated_at":"2020-08-31T13:40:15.000Z","dependencies_parsed_at":"2023-07-26T18:01:24.183Z","dependency_job_id":null,"html_url":"https://github.com/tanishqjasoria/python_practice","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanishqjasoria%2Fpython_practice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanishqjasoria%2Fpython_practice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanishqjasoria%2Fpython_practice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanishqjasoria%2Fpython_practice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tanishqjasoria","download_url":"https://codeload.github.com/tanishqjasoria/python_practice/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248159297,"owners_count":21057289,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-05T22:36:09.742Z","updated_at":"2025-04-10T04:37:15.612Z","avatar_url":"https://github.com/tanishqjasoria.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# python_prac\nPython : Practice problems for beginners\n\nQ1. Searching for Patterns:\nGiven a text txt[0..n-1] and a pattern pat[0..m-1], write a function search(pat, txt) that prints all\noccurrences of pat[] in txt[]. You may assume that n \u003e m.\n\nQ2. Check if edit distance between two strings is one:\nAn edit between two strings is one of the following changes.\n Add a character\n Delete a character\n Change a character\nGiven two string s1 and s2, find if s1 can be converted to s2 with exactly one edit.\n\nQ3. Print list items containing all characters of a given word\nThere is a list of items. Given a specific word, e.g., \"sun\", print out all the items in list which\ncontain all the characters of \"sun\".\nFor example if the given word is \"sun\" and the items are \"sunday\", \"utensils\", \"\"just\" and \"sss\",\nthen the program should print \"sunday\" and \"utensils\".\n\nQ4. Given a string, find its first non-repeating character\nGiven a string, find the first non-repeating character in it. For example, if input string is\n\"GeeksQuiz\", then output should be 'G'.\n\nQ5. Check if two given strings are isomorphic to each other\nTwo strings str1 and str2 are called isomorphic if there is a one to one mapping possible for\nevery character of str1 to every character of str2. And all occurrences of every character in 'str1'\nmap to same character in 'str2'\nExamples:\nInput: str1 = \"aab\", str2 = \"xxy\"\nOutput: True\n'a' is mapped to 'x' and 'b' is mapped to 'y'.\nInput: str1 = \"aab\", str2 = \"xyz\"\nOutput: False\nOne occurrence of 'a' in str1 has 'x' in str2 and other occurrence of 'a' has 'y'.\n\nQ6. Common elements in all rows of a given matrix\nExample: Input:\nmat[4][5] = [[1, 2, 1, 4, 8],\n [3, 7, 8, 5, 1],\n [8, 7, 7, 3, 1],\n [8, 1, 2, 7, 9], ];\nOutput:\n1 8 or 8 1\n8 and 1 are present in all rows.\n\nQ7. Print Matrix Diagonally\nGiven a 2D matrix, print all elements of the given matrix in diagonal order. For example,\nconsider the following 5 X 4 input matrix.\n 1 2 3 4\n 5 6 7 8\n 9 10 11 12\n 13 14 15 16\n 17 18 19 20\nDiagonal printing of the above matrix is\n 1\n 5 2\n 9 6 3\n 13 10 7 4\n 17 14 11 8\n 18 15 12\n 19 16\n 20\n\nQ8. Find the minimum number of swaps needed to make two lists identical. Print\n-1 if this is not possible.\nExample:\nInput: arrA = [3, 6, 4, 8], arrB = [4, 6, 8, 3]\nOutput: 2\nExplanation: swap 4 with 8, arrB = [8, 6, 4, 3]\nSwap 8 with 3, arrB = [3, 6, 4, 8]\n\nQ9. In a list of size N, find the smallest sublist whose sum is multiple of N.\nInput: arr = [1, 1, 2, 2, 4, 2]\nOutput: [2 4]\nExplanation: Size of list, N = 6 \nFollowing sublists have sum as multiple of N\n[1, 1, 2, 2], [2, 4], [1, 1, 2, 2, 4, 2]\nThe smallest among all is [2 4].\n\nQ10. Find the sum of absolute differences of all pairs in a given list.\nInput: arr = [1, 2, 3, 4]\nOutput: 10\nExplanation: |2-1| + |3-1| + |4-1| + |3-2| + |4-2| + |4-3| = 10\n\nQ11. Given a set, we need to find maximum and minimum possible product\namong all subsets of the set.\nInput: arr = [4, -2, 5]\nOutput: Maximum product = 20, Minimum product = -40\nExplanation: Maximum product is obtained by multiplying 4 5. Minimum product is obtained by\nmultiplying 4, -2, 5\n\nQ12. Reverse an array in groups of given size\nInput: arr = [1, 2, 3, 4, 5, 6, 7, 8, 9] k = 3\nOutput: [3, 2, 1, 6, 5, 4, 9, 8, 7]\n\nQ13. Remove minimum number of characters so that two strings become\nanagram of each other (anagrams are words that contain the same characters in\ndifferent order).\nInput: str1 = \"bcadeh\" str2 = \"hea\"\nOutput: 3\nExplanation: We need to remove b, c and d from str1.\n\nQ14. Compare two version numbers and print the latest version number. A\nversion number is a string which looks like a.b.c.d where a, b etc. are numbers,\nInput: V1 = “1.0.31”\nV2 = “1.0.27”\nOutput: V1\nV1 version is latest (or larger) because V2 \u003c V1\n\nQ15. You are given a string ‘str’, the task is to check that reverses of all possible\nsubstrings of ‘str’ are present in ‘str’ or not.\nInput: str = \"ab\"\nOutput: False\nExplanation: all substrings are \"a\",\"b\",\"ab\" but reverse of \"ab\" is not present in str\n\nQ16. Find all unique substrings of an input string and print them in an increasing\norder.\n\nQ17. From a list of numbers and another list of characters, print all \u003cnumber,\ncharacter\u003e pairings.\nInput: l1 = [1, 2, 3], l2 = [“c”, “e”]\nOutput: \u003c1,”c”\u003e, \u003c1,”e”\u003e, \u003c2,”c”\u003e, \u003c2,”e”\u003e, \u003c3,”c”\u003e, \u003c3,”e”\u003e.\n\nQ18. From a list of numbers and another list of characters, print all \u003cnumber,\ncharacter\u003e pairings such that in each output pair the number \u003c character’s\nordinal number (position in list).\nInput: l1 = [1, 2, 3], l2 = [“c”, “e”]\nOutput: \u003c1,”e”\u003e\n\nQ19. Read a list of 2D points (x, y coordinates), and find the area of the smallest\n(upright) rectangle enclosing all points. (bounded by the smallest and the largest\nx and y values).\n\nQ20. Find such smallest area of the rectangle if exactly one point is allowed to\nbe outside the rectangle.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftanishqjasoria%2Fpython_practice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftanishqjasoria%2Fpython_practice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftanishqjasoria%2Fpython_practice/lists"}